[Updated] D12627: worker: adapt _blockingreader to work around a python3.8.[0-1] bug (issue6444)
mjacob (Manuel Jacob)
phabricator at mercurial-scm.org
Wed May 18 03:31:47 UTC 2022
This revision now requires changes to proceed.
mjacob added inline comments.
mjacob requested changes to this revision.
INLINE COMMENTS
> worker.py:86
> + data = self._wrapped.readall()
> + b[:] = data
> + return len(data)
This could change the size of `b`, which shouldn’t be done.
If pickle calls `readinto()` (e.g. on my machine, this happens when the pickled data contains a bytestring >= 2**16 bytes long), it passes a memoryview which doesn’t allow changing its size. Because the size of `b` is the size of the pickled object and `readall()` returns all bytes in the stream, containing the bytes for the pickled object + at least one trailing byte, this line would always raise a “ValueError: memoryview assignment: lvalue and rvalue have different structures” exception.
What I suggest instead is to mostly copy-paste the implementation of `read()` and modify it such that it reads into the provided buffer instead of creating one.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12627/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12627
To: mharbison72, #hg-reviewers, mjacob
Cc: mjacob, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220518/80f78e2f/attachment-0002.html>
More information about the Mercurial-patches
mailing list