[Python-checkins] cpython (3.3): Fix issue #16270: urllib may hang when used for retrieving files via FTP by

giampaolo.rodola python-checkins at python.org
Fri Oct 19 13:35:09 CEST 2012


http://hg.python.org/cpython/rev/2e6bcbb0ff59
changeset:   79825:2e6bcbb0ff59
branch:      3.3
parent:      79822:415876f5b519
user:        Giampaolo Rodola' <g.rodola at gmail.com>
date:        Fri Oct 19 13:34:32 2012 +0200
summary:
  Fix issue #16270: urllib may hang when used for retrieving files via FTP by using a context manager.

files:
  Lib/urllib/request.py |  6 ------
  Misc/NEWS             |  3 +++
  2 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -2326,13 +2326,7 @@
         return (ftpobj, retrlen)
 
     def endtransfer(self):
-        if not self.busy:
-            return
         self.busy = 0
-        try:
-            self.ftp.voidresp()
-        except ftperrors():
-            pass
 
     def close(self):
         self.keepalive = False
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -43,6 +43,9 @@
 Library
 -------
 
+- Issue #16270: urllib may hang when used for retrieving files via FTP by using
+  a context manager.  Patch by Giampaolo Rodola'.
+
 - Issue #16176: Properly identify Windows 8 via platform.platform()
 
 - Issue #16114: The subprocess module no longer provides a misleading error

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


More information about the Python-checkins mailing list