From 6edde8a91c753dba03c92315b7585209931c704b Mon Sep 17 00:00:00 2001 From: Sam Gross Date: Tue, 9 Apr 2024 11:50:49 -0400 Subject: [PATCH] gh-117658: Fix check_dump_traceback_threads in free-threaded build (#117659) With the GIL disabled, the waiting thread may still be in the `self.running.set() ` call when faulthandler dumps tracebacks. --- Lib/test/test_faulthandler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py index 200f34d18ca..61ec8fe3151 100644 --- a/Lib/test/test_faulthandler.py +++ b/Lib/test/test_faulthandler.py @@ -575,10 +575,12 @@ class FaultHandlerTests(unittest.TestCase): lineno = 8 else: lineno = 10 + # When the traceback is dumped, the waiter thread may be in the + # `self.running.set()` call or in `self.stop.wait()`. regex = r""" ^Thread 0x[0-9a-f]+ \(most recent call first\): (?: File ".*threading.py", line [0-9]+ in [_a-z]+ - ){{1,3}} File "", line 23 in run + ){{1,3}} File "", line (?:22|23) in run File ".*threading.py", line [0-9]+ in _bootstrap_inner File ".*threading.py", line [0-9]+ in _bootstrap