Merge ~cjwatson/launchpad:py36-fix-apportjob into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Guruprasad
Approved revision: 196e4a5be7d9db896f2bded6bde332e697cbeebe
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:py36-fix-apportjob
Merge into: launchpad:master
Diff against target: 13 lines (+1/-1)
1 file modified
lib/lp/bugs/model/apportjob.py (+1/-1)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+432593@code.launchpad.net

Commit message

Fix json.dumps call for Python >= 3.6

Description of the change

The `json.dumps` call in `lp.bugs.model.apportjob` started failing on Python >= 3.6 after the change to drop the dependency on `simplejson`, because `json.dumps` changed in 3.6 to make most arguments keyword-only. Passing the encoding as a positional argument has probably been incorrect for a long time since the encoding wasn't the next argument after the object to dump, but this hasn't mattered since Python 3 anyway.

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/bugs/model/apportjob.py b/lib/lp/bugs/model/apportjob.py
2index a4612d5..05007dc 100644
3--- a/lib/lp/bugs/model/apportjob.py
4+++ b/lib/lp/bugs/model/apportjob.py
5@@ -60,7 +60,7 @@ class ApportJob(StormBase):
6 # only delegates to ApportJob we can't simply directly access the
7 # _json_data property, so we use a getter and setter here instead.
8 def _set_metadata(self, metadata):
9- self._json_data = six.ensure_text(json.dumps(metadata, "utf-8"))
10+ self._json_data = six.ensure_text(json.dumps(metadata))
11
12 def _get_metadata(self):
13 return json.loads(self._json_data)

Subscribers

People subscribed via source and target branches

to status/vote changes: