mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY Maybe I'm missing something simple, but the help for `io.BytesIO.readinto` says: Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read. and `io.BytesIO.read` says: Return an empty bytes object at EOF. That would seem to mean that if the _first_ internal `readinto()` of the nonblocking `self._wrapped` returns `None` because no data is available, the caller is tricked that EOF has been reached by returning an empty bytes object. REPOSITORY rHG Mercurial BRANCH stable REVISION DETAIL https://phab.mercurial-scm.org/D12628 AFFECTED FILES mercurial/worker.py CHANGE DETAILS diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -109,8 +109,10 @@ while pos < size: ret = self._wrapped.readinto(view[pos:]) - if not ret: - break + if ret is None: + continue # nonblocking, and no data + elif ret == 0: + break # 0 -> EOF pos += ret del view To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel