[Python-checkins] cpython: Issue #23214: Remove BufferedReader.read1(-1) workaround

martin.panter python-checkins at python.org
Thu Oct 20 22:00:14 EDT 2016


https://hg.python.org/cpython/rev/d4fce64b1c65
changeset:   104598:d4fce64b1c65
user:        Martin Panter <vadmium+py at gmail.com>
date:        Fri Oct 21 00:52:04 2016 +0000
summary:
  Issue #23214: Remove BufferedReader.read1(-1) workaround

files:
  Lib/http/client.py |  9 +--------
  1 files changed, 1 insertions(+), 8 deletions(-)


diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -642,14 +642,7 @@
             return self._read1_chunked(n)
         if self.length is not None and (n < 0 or n > self.length):
             n = self.length
-        try:
-            result = self.fp.read1(n)
-        except ValueError:
-            if n >= 0:
-                raise
-            # some implementations, like BufferedReader, don't support -1
-            # Read an arbitrarily selected largeish chunk.
-            result = self.fp.read1(16*1024)
+        result = self.fp.read1(n)
         if not result and n:
             self._close_conn()
         elif self.length is not None:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list