Skip to content

Commit d686848

Browse files
committed
In FTP.close() method, make sure to also close the socket object, not only the file.
1 parent 4cfa247 commit d686848

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/ftplib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,11 +589,11 @@ def quit(self):
589589

590590
def close(self):
591591
'''Close the connection without assuming anything about it.'''
592-
if self.file:
592+
if self.file is not None:
593593
self.file.close()
594+
if self.sock is not None:
594595
self.sock.close()
595-
self.file = self.sock = None
596-
596+
self.file = self.sock = None
597597

598598
try:
599599
import ssl

0 commit comments

Comments
 (0)