]> granicus.if.org Git - python/commitdiff
bpo-31234: test_threading: fix ref cycle (#3150) (#3152)
authorVictor Stinner <victor.stinner@gmail.com>
Sat, 19 Aug 2017 00:32:54 +0000 (02:32 +0200)
committerGitHub <noreply@github.com>
Sat, 19 Aug 2017 00:32:54 +0000 (02:32 +0200)
test_bare_raise_in_brand_new_thread() now explicitly breaks a
reference cycle to not leak a dangling thread.
(cherry picked from commit 3d284c081fc3042036adfe1bf2ce92c34d743b0b)

Lib/test/test_threading.py

index 0db028864d203a849663715462e5a7aa4d93b6d8..162a72ea03f0b286d8a1ee4aa99671b96d97620c 100644 (file)
@@ -1066,6 +1066,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):