mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
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:
parent
8d8e6156a0
commit
66c981b48b
2 changed files with 6 additions and 1 deletions
|
@ -189,7 +189,9 @@ class _socketobject(object):
|
|||
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:
|
||||
|
|
|
@ -33,6 +33,9 @@ Core and Builtins
|
|||
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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue