summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-10-31 19:58:07 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-10-31 19:58:07 (GMT)
commit1bd93a754fc0f9a801c982ab1bb3a8ee0d9d77b6 (patch)
treed7cf15e200fec3679b5967e21c51a682e70ffb77
parentd5df36d378054b0c9bcd5ac0f26e2c3786ffd30c (diff)
downloadcpython-1bd93a754fc0f9a801c982ab1bb3a8ee0d9d77b6.zip
cpython-1bd93a754fc0f9a801c982ab1bb3a8ee0d9d77b6.tar.gz
cpython-1bd93a754fc0f9a801c982ab1bb3a8ee0d9d77b6.tar.bz2
fix ftplib resource warnings
-rw-r--r--Lib/ftplib.py1
-rw-r--r--Lib/test/test_ftplib.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 50dbacc..22b5fd2 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -361,6 +361,7 @@ class FTP:
conn, sockaddr = sock.accept()
if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
conn.settimeout(self.timeout)
+ sock.close()
if resp[:3] == '150':
# this is conditional in case we received a 125
size = parse150(resp)
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index a7ea254..9d2eab7 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -355,6 +355,8 @@ if ssl is not None:
if (isinstance(self.socket, ssl.SSLSocket) and
self.socket._sslobj is not None):
self._do_ssl_shutdown()
+ else:
+ super(SSLConnection, self).close()
class DummyTLS_DTPHandler(SSLConnection, DummyDTPHandler):