summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-22 19:24:33 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2011-02-22 19:24:33 (GMT)
commitd686848807dc35ee84524c64aa7a17d9a5b927ad (patch)
tree53cf550e53329470e46081fbeb34c254a87d0bdd /Lib/ftplib.py
parent4cfa24757b2f0946994aaa96ca5e135d30b49de3 (diff)
downloadcpython-d686848807dc35ee84524c64aa7a17d9a5b927ad.zip
cpython-d686848807dc35ee84524c64aa7a17d9a5b927ad.tar.gz
cpython-d686848807dc35ee84524c64aa7a17d9a5b927ad.tar.bz2
In FTP.close() method, make sure to also close the socket object, not only the file.
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 22b5fd2..fd5a863 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -589,11 +589,11 @@ class FTP:
def close(self):
'''Close the connection without assuming anything about it.'''
- if self.file:
+ if self.file is not None:
self.file.close()
+ if self.sock is not None:
self.sock.close()
- self.file = self.sock = None
-
+ self.file = self.sock = None
try:
import ssl