瀏覽代碼

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 年之前
父節點
當前提交
efb879505b
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4
    3
      telnetlib_receive_all.py

+ 4
- 3
telnetlib_receive_all.py 查看文件

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
 # A patch was applied to this file, in order to stop dropping null (0x00) characters.
2
 # A patch was applied to this file, in order to stop dropping null (0x00) characters.
3
 
3
 
4
 r"""TELNET client class.
4
 r"""TELNET client class.
257
 
257
 
258
     def close(self):
258
     def close(self):
259
         """Close the connection."""
259
         """Close the connection."""
260
-        if self.sock:
261
-            self.sock.close()
260
+        sock = self.sock
262
         self.sock = 0
261
         self.sock = 0
263
         self.eof = 1
262
         self.eof = 1
264
         self.iacseq = ''
263
         self.iacseq = ''
265
         self.sb = 0
264
         self.sb = 0
265
+        if sock:
266
+            sock.close()
266
 
267
 
267
     def get_socket(self):
268
     def get_socket(self):
268
         """Return the socket object used internally."""
269
         """Return the socket object used internally."""

Loading…
取消
儲存