Skip to content

Commit 3d284c0

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

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
@@ -1069,6 +1069,8 @@ def run(self):
10691069
thread.join()
10701070
self.assertIsNotNone(thread.exc)
10711071
self.assertIsInstance(thread.exc, RuntimeError)
1072+
# explicitly break the reference cycle to not leak a dangling thread
1073+
thread.exc = None
10721074

10731075
class TimerTests(BaseTestCase):
10741076

0 commit comments

Comments
 (0)