summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-10-31 13:17:46 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-10-31 13:17:46 (GMT)
commita71bfc46d08bfc63fcc3322f24beb2c7faa37efa (patch)
tree85fe4d55564ed6bcac907c5b012ecaddab596d6f /Lib/test/regrtest.py
parent0d75957d91167bb4363a9db7d0d923376a73f678 (diff)
downloadcpython-a71bfc46d08bfc63fcc3322f24beb2c7faa37efa.zip
cpython-a71bfc46d08bfc63fcc3322f24beb2c7faa37efa.tar.gz
cpython-a71bfc46d08bfc63fcc3322f24beb2c7faa37efa.tar.bz2
Merged revisions 85926 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85926 | antoine.pitrou | 2010-10-29 13:54:38 +0200 (ven., 29 oct. 2010) | 3 lines Actually restore the original asyncore socket map by making a copy of the dict ........
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 92a3d11..deb4229 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -799,11 +799,12 @@ class saved_test_environment:
def get_asyncore_socket_map(self):
asyncore = sys.modules.get('asyncore')
- return asyncore and asyncore.socket_map or {}
+ # XXX Making a copy keeps objects alive until __exit__ gets called.
+ return asyncore and asyncore.socket_map.copy() or {}
def restore_asyncore_socket_map(self, saved_map):
asyncore = sys.modules.get('asyncore')
if asyncore is not None:
- asyncore.socket_map.clear()
+ asyncore.close_all(ignore_all=True)
asyncore.socket_map.update(saved_map)
def resource_info(self):
@@ -819,9 +820,11 @@ class saved_test_environment:
return self
def __exit__(self, exc_type, exc_val, exc_tb):
+ saved_values = self.saved_values
+ del self.saved_values
for name, get, restore in self.resource_info():
current = get()
- original = self.saved_values[name]
+ original = saved_values.pop(name)
# Check for changes to the resource's value
if current != original:
self.changed = True