Skip to content

Commit b50e768

Browse files
authored
bpo-31234: test_threading: fix ref cycle (#3150) (#3152)
test_bare_raise_in_brand_new_thread() now explicitly breaks a reference cycle to not leak a dangling thread. (cherry picked from commit 3d284c0)
1 parent 3e866df commit b50e768

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎Lib/test/test_threading.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,8 @@ def run(self):
10661066
thread.join()
10671067
self.assertIsNotNone(thread.exc)
10681068
self.assertIsInstance(thread.exc, RuntimeError)
1069+
# explicitly break the reference cycle to not leak a dangling thread
1070+
thread.exc = None
10691071

10701072
class TimerTests(BaseTestCase):
10711073

0 commit comments

Comments
 (0)