[Python-checkins] cpython (3.2): Simplify code in HTTPResponse.read()

antoine.pitrou python-checkins at python.org
Sat Feb 2 23:13:19 CET 2013


http://hg.python.org/cpython/rev/41d2c18abbf4
changeset:   81953:41d2c18abbf4
branch:      3.2
parent:      81950:03c536afeb7e
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sat Feb 02 23:08:51 2013 +0100
summary:
  Simplify code in HTTPResponse.read()

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


diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -515,13 +515,10 @@
             # Ideally, we would raise IncompleteRead if the content-length
             # wasn't satisfied, but it might break compatibility.
             self.close()
-        if self.length is not None:
+        elif self.length is not None:
             self.length -= len(s)
             if not self.length:
                 self.close()
-        else:
-            if not s:
-                self.close()
 
         return s
 

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


More information about the Python-checkins mailing list