summaryrefslogtreecommitdiffstats
path: root/Lib/telnetlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/telnetlib.py')
-rw-r--r--Lib/telnetlib.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py
index c8ddd97..15721c6 100644
--- a/Lib/telnetlib.py
+++ b/Lib/telnetlib.py
@@ -210,7 +210,8 @@ class Telnet:
self.sock = socket.socket(af, socktype, proto)
self.sock.connect(sa)
except socket.error, msg:
- self.sock.close()
+ if self.sock:
+ self.sock.close()
self.sock = None
continue
break