]> granicus.if.org Git - python/commitdiff
bpo-31234: test_threading: fix ref cycle (#3150)
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 18 Aug 2017 23:54:42 +0000 (01:54 +0200)
committerGitHub <noreply@github.com>
Fri, 18 Aug 2017 23:54:42 +0000 (01:54 +0200)
test_bare_raise_in_brand_new_thread() now explicitly breaks a
reference cycle to not leak a dangling thread.

Lib/test/test_threading.py

index 0f3ac555c2dc724c7f546319e8cc3bd5b282bdbe..800d26f71b289a207b563ea6dc16f1f52d2143bf 100644 (file)
@@ -1069,6 +1069,8 @@ class ThreadingExceptionTests(BaseTestCase):
         thread.join()
         self.assertIsNotNone(thread.exc)
         self.assertIsInstance(thread.exc, RuntimeError)
+        # explicitly break the reference cycle to not leak a dangling thread
+        thread.exc = None
 
 class TimerTests(BaseTestCase):