Browse Source

Original library telnet.py has had minor changes between Python 2.7.9 and Python 2.7.12

Changes from telnet.py of Python 2.7.12 are now merged in telnet_receive_all.py
RoGeorge 7 years ago
parent
commit
efb879505b
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      telnetlib_receive_all.py

+ 4
- 3
telnetlib_receive_all.py View File

@@ -1,4 +1,4 @@
1
-# This whole file is a copy of the 'telnetlib.py' that came with Python 2.7.9 distribution.
1
+# This whole file is a copy of the 'telnetlib.py' that came with Python 2.7.12 distribution.
2 2
 # A patch was applied to this file, in order to stop dropping null (0x00) characters.
3 3
 
4 4
 r"""TELNET client class.
@@ -257,12 +257,13 @@ class Telnet:
257 257
 
258 258
     def close(self):
259 259
         """Close the connection."""
260
-        if self.sock:
261
-            self.sock.close()
260
+        sock = self.sock
262 261
         self.sock = 0
263 262
         self.eof = 1
264 263
         self.iacseq = ''
265 264
         self.sb = 0
265
+        if sock:
266
+            sock.close()
266 267
 
267 268
     def get_socket(self):
268 269
         """Return the socket object used internally."""

Loading…
Cancel
Save