Mercurial > hg
comparison mercurial/keepalive.py @ 45352:49f8ba4febec stable
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
author | Cédric Krier <ced@b2ck.com> |
---|---|
date | Sun, 02 Aug 2020 17:40:35 +0200 |
parents | 9f70512ae2cf |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
45273:3d414dce2d40 | 45352:49f8ba4febec |
---|---|
540 line = self._rbuf[:i] | 540 line = self._rbuf[:i] |
541 self._rbuf = self._rbuf[i:] | 541 self._rbuf = self._rbuf[i:] |
542 return line | 542 return line |
543 | 543 |
544 # No newline in local buffer. Read until we find one. | 544 # No newline in local buffer. Read until we find one. |
545 chunks = [self._rbuf] | 545 # readinto read via readinto will already return _rbuf |
546 if self._raw_readinto is None: | |
547 chunks = [self._rbuf] | |
548 else: | |
549 chunks = [] | |
546 i = -1 | 550 i = -1 |
547 readsize = self._rbufsize | 551 readsize = self._rbufsize |
548 while True: | 552 while True: |
549 new = self._raw_read(readsize) | 553 new = self._raw_read(readsize) |
550 if not new: | 554 if not new: |