_bad_oauth_token crashes on python3 (str vs bytes)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
launchpadlib |
Fix Released
|
Undecided
|
Unassigned | ||
python-launchpadlib (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Dimitri John Ledkov |
Bug Description
[Impact]
* Unable to renew/relogin with a new oauth token, using python3 scripts
* python2 APIs work (because python2 does not care about str vs bytes)
[Test Case]
* Attempt login_with() using python3 and an expired/invalid existing token
* Relogin should be successful, without crashing scripts
[Regression Potential]
* No change in behaviour on python2 (which is what used by reverse dependencies)
* this is a backport to fix python3 behaviour, for all the newly ported maintainance scripts in python3 that prefer to run on "stable" systems
[Other Info]
* Well tested in later releases, and with users running from trunk.
* I believe this still is not published in the cheeseshop.
[Original bug report]
Hi
Running something as simple as
>>> from launchpadlib.
>>> launchpad = Launchpad.
Results in a traceback such as this one:
Traceback (most recent call last):
File "./foo.py", line 31, in <module>
lb = launchpad.
File "/usr/lib/
shim_
File "/usr/lib/
representation = self._root.
File "/usr/lib/
response, content = self._request(url, extra_headers=
File "/usr/lib/
str(url), method=method, body=data, headers=headers)
File "/usr/lib/
url, method=method, body=body, headers=headers)
File "/usr/lib/
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/lib/
return self.retry_
File "/usr/lib/
if (self._
File "/usr/lib/
(content.
TypeError: startswith first arg must be bytes or a tuple of bytes, not str
This doesn't happen on python2. I will follow up with a patch shortly.
Related branches
- Dimitri John Ledkov (community): Approve
- Colin Watson (community): Approve
-
Diff: 115 lines (+15/-15)2 files modifiedsrc/launchpadlib/launchpad.py (+3/-3)
src/launchpadlib/tests/test_http.py (+12/-12)
Changed in launchpadlib: | |
status: | New → Fix Committed |
Changed in python-launchpadlib (Ubuntu): | |
status: | New → Fix Released |
Changed in python-launchpadlib (Ubuntu Xenial): | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Dimitri John Ledkov (xnox) |
milestone: | none → ubuntu-16.04.2 |
Changed in python-launchpadlib (Ubuntu Xenial): | |
status: | Triaged → In Progress |
description: | updated |
I've added a quick patch that I cooked for this issue. Have a look to say if I'm on the right track. This builds cleanly for me in the ppa:zyga/ launchpadlib- backports in a trusty sbuild chroot.