[Python-checkins] r84382 - in python/branches/release27-maint: Lib/socket.py Misc/NEWS

daniel.stutzbach python-checkins at python.org
Tue Aug 31 22:29:39 CEST 2010


Author: daniel.stutzbach
Date: Tue Aug 31 22:29:39 2010
New Revision: 84382

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/release27-maint/Lib/socket.py
   python/branches/release27-maint/Misc/NEWS

Modified: python/branches/release27-maint/Lib/socket.py
==============================================================================
--- python/branches/release27-maint/Lib/socket.py	(original)
+++ python/branches/release27-maint/Lib/socket.py	Tue Aug 31 22:29:39 2010
@@ -189,7 +189,9 @@
         for method in _delegate_methods:
             setattr(self, method, getattr(_sock, method))
 
-    def close(self):
+    def close(self, _closedsocket=_closedsocket,
+              _delegate_methods=_delegate_methods, setattr=setattr):
+        # This function should not reference any globals. See issue #808164.
         self._sock = _closedsocket()
         dummy = self._sock._dummy
         for method in _delegate_methods:

Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Tue Aug 31 22:29:39 2010
@@ -33,6 +33,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 #8797: urllib2 does a retry for Basic Authentication failure instead of
   falling into recursion.
 


More information about the Python-checkins mailing list