]> granicus.if.org Git - python/commitdiff
Issue #27787: Clean up weak references before checking for dangling threads
authorMartin Panter <vadmium+py@gmail.com>
Sat, 20 Aug 2016 06:50:14 +0000 (06:50 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sat, 20 Aug 2016 06:50:14 +0000 (06:50 +0000)
Lib/test/regrtest.py
Misc/NEWS

index fecfd0967a27bf62831b8496fcec5cf611daeddd..ba8a780fc9e9631eb164b55e2d6e8de97b6ee33c 100755 (executable)
@@ -1258,6 +1258,7 @@ class saved_test_environment:
     def __exit__(self, exc_type, exc_val, exc_tb):
         saved_values = self.saved_values
         del self.saved_values
+        support.gc_collect()  # Some resources use weak references
         for name, get, restore in self.resource_info():
             current = get()
             original = saved_values.pop(name)
index 07a76e6bf039bbf36261a0e9342765aaecd03dd2..3ef2e6105eb8033f85634f07669ad0bdad368999 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -155,6 +155,9 @@ C API
 Tests
 -----
 
+- Issue #27787: Call gc.collect() before checking each test for "dangling
+  threads", since the dangling threads are weak references.
+
 - Issue #27369: In test_pyexpat, avoid testing an error message detail that
   changed in Expat 2.2.0.