From: Victor Stinner Date: Sun, 2 Jun 2019 21:08:41 +0000 (+0200) Subject: bpo-36829: test_threading: Fix a ref cycle (GH-13752) X-Git-Tag: v3.8.0b1~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cdce0574d03005e27b843fc110c54c99c7a76412;p=thirdparty%2FPython%2Fcpython.git bpo-36829: test_threading: Fix a ref cycle (GH-13752) --- diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 8c8cc128b051..6ac4ea9623de 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)