Commit a3bfadd8 authored by Victor Stinner's avatar Victor Stinner

(Merge 3.4) Issue #23881: urllib.request.ftpwrapper constructor now closes the

socket if the FTP connection failed to fix a ResourceWarning.
parents 7c6702a0 2280538a
...@@ -2255,7 +2255,11 @@ class ftpwrapper: ...@@ -2255,7 +2255,11 @@ class ftpwrapper:
self.timeout = timeout self.timeout = timeout
self.refcount = 0 self.refcount = 0
self.keepalive = persistent self.keepalive = persistent
try:
self.init() self.init()
except:
self.close()
raise
def init(self): def init(self):
import ftplib import ftplib
......
...@@ -19,6 +19,9 @@ Core and Builtins ...@@ -19,6 +19,9 @@ Core and Builtins
Library Library
------- -------
- Issue #23881: urllib.request.ftpwrapper constructor now closes the socket if
the FTP connection failed to fix a ResourceWarning.
- Issue #23853: :meth:`socket.socket.sendall` does no more reset the socket - Issue #23853: :meth:`socket.socket.sendall` does no more reset the socket
timeout each time data is sent successfuly. The socket timeout is now the timeout each time data is sent successfuly. The socket timeout is now the
maximum total duration to send all data. maximum total duration to send all data.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment