From cdce0574d03005e27b843fc110c54c99c7a76412 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 2 Jun 2019 23:08:41 +0200 Subject: bpo-36829: test_threading: Fix a ref cycle (GH-13752) --- Lib/test/test_threading.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Lib/test/test_threading.py') diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 8c8cc128b05..6ac4ea9623d 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) -- cgit v1.2.3