# HG changeset patch # User Cédric Krier # Date 1596382835 -7200 # Node ID 49f8ba4febec5100ee84b49afef63e19879fa75d # Parent 3d414dce2d40bd8d20efdd0ac03659ed1aba2f7e keepalive: Do not append _rbuf if _raw_readinto exists (issue6356) 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. Differential Revision: https://phab.mercurial-scm.org/D8859 diff -r 3d414dce2d40 -r 49f8ba4febec mercurial/keepalive.py --- a/mercurial/keepalive.py Mon Aug 03 23:13:58 2020 +0530 +++ b/mercurial/keepalive.py Sun Aug 02 17:40:35 2020 +0200 @@ -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: