]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #808164: Fixed socket.close to avoid references to globals, to
authorDaniel Stutzbach <daniel@stutzbachenterprises.com>
Tue, 31 Aug 2010 20:08:07 +0000 (20:08 +0000)
committerDaniel Stutzbach <daniel@stutzbachenterprises.com>
Tue, 31 Aug 2010 20:08:07 +0000 (20:08 +0000)
avoid issues when socket.close is called from a __del__ method.

Lib/socket.py
Misc/NEWS

index 781887583cf0141fc38cc524b51ef38ae2b43556..30a01aa198674610dfa53d77674c3b20430862d1 100644 (file)
@@ -172,10 +172,12 @@ class socket(_socket.socket):
         if self._closed:
             self.close()
 
-    def _real_close(self):
-        _socket.socket.close(self)
+    def _real_close(self, _ss=_socket.socket):
+        # This function should not reference any globals.  See Issue808164
+        _ss.close(self)
 
     def close(self):
+        # This function should not reference any globals.  See Issue808164
         self._closed = True
         if self._io_refs <= 0:
             self._real_close()
index e32d61e802f63e95a970adf906ebd8b3fd41378c..372b0b3c420837b8fb499912cd213ea53458c3ef 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -142,6 +142,9 @@ Extensions
 Library
 -------
 
+- Issue #808164: Fixed socket.close to avoid references to globals, to
+  avoid issues when socket.close is called from a __del__ method.
+
 - Issue #9706: ssl module provides a better error handling in various 
   circumstances.