Patchwork [2,of,3] keepalive: remove limit argument from readline()

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 26, 2016, 6:53 p.m.
Message ID <d238f7c120d82a68f39c.1482778406@gps-mbp.local>
Download mbox | patch
Permalink /patch/18042/
State Accepted
Headers show

Comments

Gregory Szorc - Dec. 26, 2016, 6:53 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1444258438 25200
#      Wed Oct 07 15:53:58 2015 -0700
# Node ID d238f7c120d82a68f39ccb82488370a5191957bb
# Parent  a1601f6c4e504f9e9ee8174f9390398b622ef219
keepalive: remove limit argument from readline()

It is unused and adds complexity.

Patch

diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py
--- a/mercurial/keepalive.py
+++ b/mercurial/keepalive.py
@@ -450,11 +450,11 @@  class HTTPResponse(httplib.HTTPResponse)
         self.close()
 
         return ''.join(parts)
 
-    def readline(self, limit=-1):
+    def readline(self):
         i = self._rbuf.find('\n')
-        while i < 0 and not (0 < limit <= len(self._rbuf)):
+        while i < 0:
             new = self._raw_read(self._rbufsize)
             if not new:
                 break
             i = new.find('\n')
@@ -464,10 +464,8 @@  class HTTPResponse(httplib.HTTPResponse)
         if i < 0:
             i = len(self._rbuf)
         else:
             i = i + 1
-        if 0 <= limit < len(self._rbuf):
-            i = limit
         data, self._rbuf = self._rbuf[:i], self._rbuf[i:]
         return data
 
     def readlines(self, sizehint=0):