D4728: keepalive: be more careful about self._rbuf when calling super impls

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Mon Sep 24 22:59:02 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1cf1680b0554: keepalive: be more careful about self._rbuf when calling super impls (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4728?vs=11336&id=11338

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

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
@@ -417,9 +417,12 @@
                 s = self._rbuf[:amt]
                 self._rbuf = self._rbuf[amt:]
                 return s
-
-        s = self._rbuf + self._raw_read(amt)
+        # Careful! http.client.HTTPResponse.read() on Python 3 is
+        # implemented using readinto(), which can duplicate self._rbuf
+        # if it's not empty.
+        s = self._rbuf
         self._rbuf = ''
+        s += self._raw_read(amt)
         return s
 
     # stolen from Python SVN #68532 to fix issue1088



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list