From b50e7683acac36ff16e6c6c2c32d9a15e46b5174 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 19 Aug 2017 02:32:54 +0200 Subject: [PATCH] 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 3d284c081fc3042036adfe1bf2ce92c34d743b0b) --- Lib/test/test_threading.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 0db028864d2..162a72ea03f 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -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):