[Python-checkins] bpo-31234: test_threading: fix ref cycle (#3150)

Victor Stinner webhook-mailer at python.org
Fri Aug 18 19:54:45 EDT 2017


https://github.com/python/cpython/commit/3d284c081fc3042036adfe1bf2ce92c34d743b0b
commit: 3d284c081fc3042036adfe1bf2ce92c34d743b0b
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-08-19T01:54:42+02:00
summary:

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.

files:
M Lib/test/test_threading.py

diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 0f3ac555c2d..800d26f71b2 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -1069,6 +1069,8 @@ def run(self):
         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):
 



More information about the Python-checkins mailing list