Closed Bug 1605124 Opened 4 years ago Closed 4 years ago

unable to apply patch: "Type Error: the JSON object must be str, not 'bytes'"

Categories

(Conduit :: moz-phab, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: froydnj, Assigned: mhentges)

Details

Attachments

(2 files)

STR:

  1. Use a git checkout of mozilla-central.
  2. moz-phab patch --apply-to here D39593

ER:

Local tree is updated.

AR:

TypeError: the JSON object must be str, not 'bytes'

This error also occurs with moz-phab patch --raw D39593, which suggests that the problem is a little deeper than just a single command.

It's worth trying moz-phab with the --arc flag to use the old phabricator communication logic.

:froydnj how have you set up your git checkout of mozilla-central? Are you using git-cinnabar against https://hg.mozilla.org/mozilla-central?

Flags: needinfo?(nfroyd)

(In reply to Mitchell Hentges [:mhentges] from comment #2)

It's worth trying moz-phab with the --arc flag to use the old phabricator communication logic.

:froydnj how have you set up your git checkout of mozilla-central? Are you using git-cinnabar against https://hg.mozilla.org/mozilla-central?

I am using git-cinnabar. The problem seems to be here:

https://github.com/mozilla-conduit/review/blob/master/mozphab/mozphab.py#L721-L722

conn.getresponse() is returning bytes for me, so there needs to be a utf8 decode in there?

Flags: needinfo?(nfroyd)

Sounds good - I'd just like to reproduce the issue locally before I submit an official patch :)
I'll give git-cinnabar + D39593 a try

I'm able to reproduce this with Python 3.5.9.
This couldn't be reproduced on newer versions of Python because json.load(...) changed to support binary strings in Python 3.6.

Starting in Python 3.6, json.load(...) supports binary input. Prior to this, you have to ensure that you're only feeding it UTF-8 strings, which we haven't been doing here.

Assignee: nobody → mhentges
Status: NEW → ASSIGNED
Priority: -- → P1

I'll push out a new version of moz-phab tomorrow

I landed the original patch without running tests, and we had two failures. This resolves the tests.

This has been fixed and released in MozPhab 0.1.70 :)
Please re-open if you're still seeing the issue!

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: