summaryrefslogtreecommitdiff
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-06-02 23:08:41 +0200
committerGitHub <noreply@github.com>2019-06-02 23:08:41 +0200
commitcdce0574d03005e27b843fc110c54c99c7a76412 (patch)
tree8896e4aef432f89cfdc249549daf72dcfa6820b8 /Lib/test/test_threading.py
parentaca273e2401ca3151e15e984f400233b7f255e15 (diff)
downloadcpython-git-cdce0574d03005e27b843fc110c54c99c7a76412.tar.gz
bpo-36829: test_threading: Fix a ref cycle (GH-13752)
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)