[Bug 1965325] Re: upstream patch from opendev - double encoding-decoding
Heather Lemon
1965325 at bugs.launchpad.net
Wed Mar 23 14:57:06 UTC 2022
** Description changed:
+ [Impact]
Both iter_content and the first line of the loop in the
etcd3gw watch code were decoding the chunk received.
+ Thus, etcd3gw's watch is broken in python3. This commit
+ fixes it by only decoding the line once.
+
+ [Test Plan]
In python2, this works fine:
```
$ python2 -c "print(b'hello_world'.decode().decode('utf-8'))"
hello_world
```
In python3, it raises an AttributeError:
```
$ python3 -c "print(b'hello_world'.decode().decode('utf-8'))"
Traceback (most recent call last):
- File "<string>", line 1, in <module>
+ File "<string>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
```
- Link to patch: https://opendev.org/openstack/etcd3gw/commit/ed899b34e464862525f76fff2377a2cceeb65af7
+
+ [Regression potential]
+ In bionic patch, apply the patch fails the unit tests in Python27.
+ This is fixed by fixing the imports to:
+ +-from unittest import mock
+ ++from mock import patch, MagicMock
+
+
+ [Other Info]
+ Link to upstream patch: https://opendev.org/openstack/etcd3gw/commit/ed899b34e464862525f76fff2377a2cceeb65af7
python-etcd3gw-0.2.5 (focal)
** Description changed:
[Impact]
Both iter_content and the first line of the loop in the
etcd3gw watch code were decoding the chunk received.
Thus, etcd3gw's watch is broken in python3. This commit
fixes it by only decoding the line once.
[Test Plan]
In python2, this works fine:
```
$ python2 -c "print(b'hello_world'.decode().decode('utf-8'))"
hello_world
```
In python3, it raises an AttributeError:
```
$ python3 -c "print(b'hello_world'.decode().decode('utf-8'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
```
[Regression potential]
- In bionic patch, apply the patch fails the unit tests in Python27.
+ In bionic patch, applying the patch fails the unit tests in Python27.
This is fixed by fixing the imports to:
+-from unittest import mock
- ++from mock import patch, MagicMock
-
+ ++from mock import patch, MagicMock
[Other Info]
Link to upstream patch: https://opendev.org/openstack/etcd3gw/commit/ed899b34e464862525f76fff2377a2cceeb65af7
python-etcd3gw-0.2.5 (focal)
--
You received this bug notification because you are a member of Ubuntu
Sponsors Team, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1965325
Title:
upstream patch from opendev - double encoding-decoding
Status in python-etcd3gw package in Ubuntu:
In Progress
Status in python-etcd3gw source package in Bionic:
In Progress
Status in python-etcd3gw source package in Focal:
In Progress
Status in python-etcd3gw source package in Impish:
In Progress
Status in python-etcd3gw source package in Jammy:
In Progress
Bug description:
[Impact]
Both iter_content and the first line of the loop in the
etcd3gw watch code were decoding the chunk received.
Thus, etcd3gw's watch is broken in python3. This commit
fixes it by only decoding the line once.
[Test Plan]
In python2, this works fine:
```
$ python2 -c "print(b'hello_world'.decode().decode('utf-8'))"
hello_world
```
In python3, it raises an AttributeError:
```
$ python3 -c "print(b'hello_world'.decode().decode('utf-8'))"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
```
[Regression potential]
In bionic patch, applying the patch fails the unit tests in Python27.
This is fixed by fixing the imports to:
+-from unittest import mock
++from mock import patch, MagicMock
[Other Info]
Link to upstream patch: https://opendev.org/openstack/etcd3gw/commit/ed899b34e464862525f76fff2377a2cceeb65af7
python-etcd3gw-0.2.5 (focal)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-etcd3gw/+bug/1965325/+subscriptions
More information about the Ubuntu-sponsors
mailing list