Closed Bug 1506297 Opened Last year Closed Last year

Cast bytearray to bytes in WSGI application output

Categories

(Developer Services :: Mercurial: hg.mozilla.org, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gps, Assigned: gps)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

It didn't take me long to find the first bug in wire protocol v2!

The new code emits bytearray instances from the WSGI application. This is apparently against PEP-3333: applications must emit bytes instances and nothing else.

We will need to adjust the WSGI application behavior to cast bytearray to bytes.

I've already submitted a patch against Mercurial to fix this issue upstream. It should be in 4.8.1.
Mercurial 4.8 may emit bytearray instances from its WSGI application.
This is apparently against PEP-3333 and mod_wsgi complains.

This commit works around the bug by filtering for bytearray in
WSGI application output and casting to bytes.

The upstream bug should be fixed in 4.8.1.
Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/0d4e27a04fb9
hgmo: cast bytearray to bytes ; r=sheehan
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.