[Updated] D12627: worker: adapt _blockingreader to work around a python3.8.[0-1] bug (issue6444)

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Fri May 20 15:14:44 UTC 2022


baymax added a comment.
baymax updated this revision to Diff 33418.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)
  ⚠ This patch is intended for stable ⚠
  <img src="https://phab.mercurial-scm.org/file/data/tk3rgakdujavwukytw2g/PHID-FILE-tayks2qokskleaybqod2/source.gif" />

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12627?vs=33407&id=33418

BRANCH
  stable

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12627/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D12627

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
@@ -78,6 +78,21 @@
         # _wrapped.readinto(), since that is unbuffered. The unpickler is fine
         # with just read() and readline(), so we don't need to implement it.
 
+        if (3, 8, 0) <= sys.version_info[:3] < (3, 8, 2):
+
+            # This is required for python 3.8, prior to 3.8.2.  See issue6444.
+            def readinto(self, b):
+                pos = 0
+                size = len(b)
+
+                while pos < size:
+                    ret = self._wrapped.readinto(b[pos:])
+                    if not ret:
+                        break
+                    pos += ret
+
+                return pos
+
         def readline(self):
             return self._wrapped.readline()
 



To: mharbison72, #hg-reviewers, mjacob, Alphare
Cc: martinvonz, Alphare, mjacob, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220520/6f64db5e/attachment-0002.html>


More information about the Mercurial-patches mailing list