Issue #808164: Fixed socket.close to avoid references to globals, to

avoid issues when socket.close is called from a __del__ method.
This commit is contained in:
Daniel Stutzbach 2010-08-31 20:29:39 +00:00
parent 8d8e6156a0
commit 66c981b48b
2 changed files with 6 additions and 1 deletions

View file

@ -189,7 +189,9 @@ class _socketobject(object):
for method in _delegate_methods: for method in _delegate_methods:
setattr(self, method, getattr(_sock, method)) 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() self._sock = _closedsocket()
dummy = self._sock._dummy dummy = self._sock._dummy
for method in _delegate_methods: for method in _delegate_methods:

View file

@ -33,6 +33,9 @@ Core and Builtins
Library 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 - Issue #8797: urllib2 does a retry for Basic Authentication failure instead of
falling into recursion. falling into recursion.