[Python-checkins] r86061 - in python/branches/py3k/Lib: ftplib.py test/test_ftplib.py

benjamin.peterson python-checkins at python.org
Sun Oct 31 20:58:08 CET 2010


Author: benjamin.peterson
Date: Sun Oct 31 20:58:07 2010
New Revision: 86061

Log:
fix ftplib resource warnings

Modified:
   python/branches/py3k/Lib/ftplib.py
   python/branches/py3k/Lib/test/test_ftplib.py

Modified: python/branches/py3k/Lib/ftplib.py
==============================================================================
--- python/branches/py3k/Lib/ftplib.py	(original)
+++ python/branches/py3k/Lib/ftplib.py	Sun Oct 31 20:58:07 2010
@@ -361,6 +361,7 @@
             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)

Modified: python/branches/py3k/Lib/test/test_ftplib.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ftplib.py	(original)
+++ python/branches/py3k/Lib/test/test_ftplib.py	Sun Oct 31 20:58:07 2010
@@ -355,6 +355,8 @@
             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):


More information about the Python-checkins mailing list