[Request] [+ ] D8859: keepalive: Do not append _rbuf if _raw_readinto exists (issue6356)

ced (Cédric Krier) phabricator at mercurial-scm.org
Sun Aug 2 15:41:16 UTC 2020


ced created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The readline method append to the chunks the content of the _rbuf then there
  is a loop that call _raw_read which on Python3 call readinto. But the readinto
  version in mercurial append again the _rbuf content. So this creates the
  duplicate content. This does not happen in Python2 because _raw_read does not
  call readinto.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/keepalive.py

CHANGE DETAILS

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -542,7 +542,11 @@
             return line
 
         # No newline in local buffer. Read until we find one.
-        chunks = [self._rbuf]
+        # readinto read via readinto will already return _rbuf
+        if self._raw_readinto is None:
+            chunks = [self._rbuf]
+        else:
+            chunks = []
         i = -1
         readsize = self._rbufsize
         while True:



To: ced, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200802/8e7a74a4/attachment.html>


More information about the Mercurial-patches mailing list