bpo-36829: test_threading: Fix a ref cycle (GH-13752)

This commit is contained in:
Victor Stinner 2019-06-02 23:08:41 +02:00 committed by GitHub
parent aca273e240
commit cdce0574d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View 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)