From: Giampaolo Rodola' <g.rodola@gmail.com> Date: Fri, 19 Oct 2012 11:40:28 +0000 (+0200) Subject: Fix issue #16270: urllib may hang when used for retrieving files via FTP by using... X-Git-Tag: v3.3.1rc1~776^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d51f687e133fb8141f1a6b5a6ac51c9d5eddf58;p=python Fix issue #16270: urllib may hang when used for retrieving files via FTP by using a context manager. --- diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index d6f9f9a1bc..64092cf7d6 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -2212,13 +2212,7 @@ class ftpwrapper: 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 index 0efbefae70..436a24967f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -129,6 +129,9 @@ Core and Builtins 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