mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #10883: Fix socket leaks in urllib.request.
* ftpwrapper now uses reference counting to ensure that the underlying socket is closed when the ftpwrapper object is no longer in use * ftplib.FTP.ntransfercmd() now closes the socket if an error occurs Initial patch by Victor Stinner.
This commit is contained in:
parent
578617ad45
commit
b42c53e442
6 changed files with 65 additions and 31 deletions
|
@ -611,6 +611,7 @@ class HandlerTests(unittest.TestCase):
|
|||
def retrfile(self, filename, filetype):
|
||||
self.filename, self.filetype = filename, filetype
|
||||
return StringIO.StringIO(self.data), len(self.data)
|
||||
def close(self): pass
|
||||
|
||||
class NullFTPHandler(urllib2.FTPHandler):
|
||||
def __init__(self, data): self.data = data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue