diff options
author | Daniel Stutzbach <daniel@stutzbachenterprises.com> | 2010-08-31 20:29:39 +0000 |
---|---|---|
committer | Daniel Stutzbach <daniel@stutzbachenterprises.com> | 2010-08-31 20:29:39 +0000 |
commit | 66c981b48b7337a385a0a23b2e36cc95d9339445 (patch) | |
tree | 7d59e752a02efd3d73c7ea07424dab7f91ed8199 | |
parent | 8d8e6156a00e67fda1edc1bdb657097eaf5c1459 (diff) | |
download | cpython-git-66c981b48b7337a385a0a23b2e36cc95d9339445.tar.gz |
Issue #808164: Fixed socket.close to avoid references to globals, to
avoid issues when socket.close is called from a __del__ method.
-rw-r--r-- | Lib/socket.py | 4 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/socket.py b/Lib/socket.py index 9b4bedaafb..9ed2de9132 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -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. |