[Python-checkins] r84380 - in python/branches/py3k: Lib/socket.py Misc/NEWS

daniel.stutzbach python-checkins at python.org
Tue Aug 31 22:08:07 CEST 2010


Author: daniel.stutzbach
Date: Tue Aug 31 22:08:07 2010
New Revision: 84380

Log:
Issue #808164: Fixed socket.close to avoid references to globals, to
avoid issues when socket.close is called from a __del__ method.

Modified:
   python/branches/py3k/Lib/socket.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/socket.py
==============================================================================
--- python/branches/py3k/Lib/socket.py	(original)
+++ python/branches/py3k/Lib/socket.py	Tue Aug 31 22:08:07 2010
@@ -172,10 +172,12 @@
         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()

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Tue Aug 31 22:08:07 2010
@@ -142,6 +142,9 @@
 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.
 


More information about the Python-checkins mailing list