Closed Bug 1654549 Opened 2 months ago Closed 2 months ago

[mozlog] LoggingWrapper doesn't have a buffer attribute

Categories

(Testing :: Mozbase, defect)

defect

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: jgraham, Assigned: jgraham)

Details

Attachments

(1 file)

When running under Py3, mozprocess tries to access sys.stdout.buffer to get the handle of something that accepts bytes. The problem is that if stdout is wrapped with some custom file-like it might not have that attribute. mozlog has a LoggingWrapper which is a BytesIO that can wrap stdout. This doesn't have a buffer attribute (and technically isn't a good wrapper for stdio since it derives from BytesIO, but in practice write handles bytes and text).

stdout in Python 3 has a buffer attribute that gives access to the
underlying bytestream. Code trying to access this will fail with
LoggingWrapper, because the property isn't defined. In practice the
write() method of LoggingWrapper handles both bytes and text, so
it's sufficient to just return the object itself.

Assignee: nobody → james
Status: NEW → ASSIGNED
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/autoland/rev/db80fd693933
Give mozlog's LoggingWrapper a buffer attribute, r=ahal
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.