]> granicus.if.org Git - python/commitdiff
bpo-36829: test_threading: Fix a ref cycle (GH-13752)
authorVictor Stinner <vstinner@redhat.com>
Sun, 2 Jun 2019 21:08:41 +0000 (23:08 +0200)
committerGitHub <noreply@github.com>
Sun, 2 Jun 2019 21:08:41 +0000 (23:08 +0200)
Lib/test/test_threading.py

index 8c8cc128b0513b6c04194de3852a93e2e445cd8b..6ac4ea9623de0d065d936fcbfb712ce792021104 100644 (file)
@@ -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)