getArchiveSubscriptionURL() crashes on python3

Bug #1714960 reported by Łukasz Zemczak
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
lazr.restfulclient
Fix Released
High
Colin Watson
lazr.restfulclient (Ubuntu)
Fix Released
High
Colin Watson
Xenial
Fix Released
High
Andy Whitcroft

Bug Description

[Impact]

When trying to use the me.getArchiveSubscriptionURL() call on Python 3, an exception is generated:

Traceback (most recent call last):
  File "./test.py", line 9, in <module>
    print(me.getArchiveSubscriptionURL(archive=ppa))
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 622, in __call__
    self.resource.lp_refresh()
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 759, in lp_refresh
    super(Entry, self).lp_refresh(new_url, etag)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 346, in lp_refresh
    representation, self.JSON_MEDIA_TYPE)
  File "/usr/lib/python3/dist-packages/wadllib/application.py", line 363, in bind
    representation_definition)
  File "/usr/lib/python3/dist-packages/wadllib/application.py", line 300, in __init__
    _make_unicode(representation))
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The same code works fine on python2 (e.g. lp-shell). Because of this being broken, I'm unable to add some modification for ESM precise handling in our kernel review scripts as those are Python 3 based.

[Test Case]

# Make sure you have a private PPA to which a subscription for the user is made
from launchpadlib.launchpad import Launchpad
PPA_LINK = '' # API link to the PPA here
lp = Launchpad.login_with('test-broken-url', 'production', version='devel')
ppa = lp.load(PPA_LINK)
me = lp.load(lp.me.self_link)
print(me.getArchiveSubscriptionURL(archive=ppa))

[Regression Potential]

Seriously none.

Related branches

Colin Watson (cjwatson)
affects: launchpadlib → lazr.restfulclient
Colin Watson (cjwatson)
Changed in lazr.restfulclient:
assignee: nobody → Colin Watson (cjwatson)
importance: Undecided → High
status: New → Fix Committed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

\o/ Thanks Colin!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lazr.restfulclient (Ubuntu):
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed in 0.13.5.

Changed in lazr.restfulclient (Ubuntu):
assignee: nobody → Colin Watson (cjwatson)
importance: Undecided → High
status: Confirmed → In Progress
Changed in lazr.restfulclient:
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Tested locally and it works like a charm. Thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lazr.restfulclient - 0.13.5-1

---------------
lazr.restfulclient (0.13.5-1) unstable; urgency=medium

  * Team upload.
  * New upstream release:
    - Fix handling of 304 responses with an empty body on Python 3
      (LP: #1714960).

 -- Colin Watson <email address hidden> Mon, 04 Sep 2017 17:10:30 +0100

Changed in lazr.restfulclient (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Andy Whitcroft (apw) wrote :

Also seen in xenial.

Changed in lazr.restfulclient (Ubuntu Xenial):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Andy Whitcroft (apw)
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Łukasz, or anyone else affected,

Accepted lazr.restfulclient into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/lazr.restfulclient/0.13.4-5ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

description: updated
Changed in lazr.restfulclient (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-xenial
Revision history for this message
Andy Whitcroft (apw) wrote :

Confirmed this is fixed by the lazr.restfulclient/0.13.4-5ubuntu2 package.

tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lazr.restfulclient - 0.13.4-5ubuntu2

---------------
lazr.restfulclient (0.13.4-5ubuntu2) xenial; urgency=medium

  * Cherry-pick from upstream:
    - Fix handling of 304 responses with an empty body on Python 3
      (LP: #1714960).

 -- Andy Whitcroft <email address hidden> Mon, 08 Jul 2019 14:44:42 +0100

Changed in lazr.restfulclient (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for lazr.restfulclient has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.