diff -r 7050c9fc1f72 Lib/urllib.py --- a/Lib/urllib.py Wed May 04 11:28:09 2016 +0300 +++ b/Lib/urllib.py Wed May 04 17:26:54 2016 -0700 @@ -932,13 +932,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 -r 7050c9fc1f72 Misc/NEWS --- a/Misc/NEWS Wed May 04 11:28:09 2016 +0300 +++ b/Misc/NEWS Wed May 04 17:26:54 2016 -0700 @@ -9,6 +9,8 @@ Core and Builtins ----------------- +- Issue #26960: Backported #16270 from Python 3 to Python 2, to prevent + urllib from hanging when retrieving certain FTP files. - Issue #4806: Avoid masking the original TypeError exception when using star (*) unpacking and the exception was raised from a generator. Based on