summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-08-31 20:08:07 (GMT)
committerDaniel Stutzbach <daniel@stutzbachenterprises.com>2010-08-31 20:08:07 (GMT)
commit19d6a4fd4974a0536a02c93a0dc878194a1d4691 (patch)
treeeddd00809d7cbadfb218b55c441a8e33a650f5b4
parenta606faa491af05b99dba6ebafa57662cf6b451fe (diff)
downloadcpython-19d6a4fd4974a0536a02c93a0dc878194a1d4691.zip
cpython-19d6a4fd4974a0536a02c93a0dc878194a1d4691.tar.gz
cpython-19d6a4fd4974a0536a02c93a0dc878194a1d4691.tar.bz2
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.py6
-rw-r--r--Misc/NEWS3
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/socket.py b/Lib/socket.py
index 7818875..30a01aa 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -172,10 +172,12 @@ class socket(_socket.socket):
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()
diff --git a/Misc/NEWS b/Misc/NEWS
index e32d61e..372b0b3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -142,6 +142,9 @@ Extensions
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.