]> granicus.if.org Git - python/commitdiff
fix ftplib resource warnings
authorBenjamin Peterson <benjamin@python.org>
Sun, 31 Oct 2010 19:58:07 +0000 (19:58 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 31 Oct 2010 19:58:07 +0000 (19:58 +0000)
Lib/ftplib.py
Lib/test/test_ftplib.py

index 50dbacc18fbfa1abca7e320bd16d51e6214c3a9c..22b5fd2175a44c90d86b9fdc6d70a02a87a7fb24 100644 (file)
@@ -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)
index a7ea254d950431eeefa63c6b4414bf8b37bfaaa4..9d2eab7fa3a363e0298d43d478bab2cb9d365404 100644 (file)
@@ -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):