summaryrefslogtreecommitdiff
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 8c8cc128b0..6ac4ea9623 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -1140,7 +1140,11 @@ class ExceptHookTests(BaseTestCase):
raise ValueError("bug")
except Exception as exc:
args = threading.ExceptHookArgs([*sys.exc_info(), None])
- threading.excepthook(args)
+ try:
+ threading.excepthook(args)
+ finally:
+ # Explicitly break a reference cycle
+ args = None
stderr = stderr.getvalue().strip()
self.assertIn(f'Exception in thread {threading.get_ident()}:\n', stderr)