D5704: util: cast memoryview to bytes
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Fri Jan 25 21:18:26 EST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG435e8884fc2f: util: cast memoryview to bytes (authored by indygreg, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5704?vs=13473&id=13482
REVISION DETAIL
https://phab.mercurial-scm.org/D5704
AFFECTED FILES
mercurial/util.py
CHANGE DETAILS
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -789,6 +789,12 @@
res))
data = dest[0:res] if res is not None else b''
+
+ # _writedata() uses "in" operator and is confused by memoryview because
+ # characters are ints on Python 3.
+ if isinstance(data, memoryview):
+ data = data.tobytes()
+
self._writedata(data)
def write(self, res, data):
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list