This is an archive of the discontinued Mercurial Phabricator instance.

util: cast memoryview to bytes
ClosedPublic

Authored by indygreg on Jan 25 2019, 7:01 PM.

Details

Summary

Python 3 uses readinto() instead of read() in places. And
taking a slice of the buffer passed to readinto() will produce
a memoryview. _writedata() then gets confused when testing for
b'\n' in data because memoryview is an iterable over ints
instead of 1 character bytes.

We work around by casting a memoryview to bytes.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Jan 25 2019, 7:01 PM
This revision was automatically updated to reflect the committed changes.