Skip to content

Commit 2f59d41

Browse files
authored
GH-110796: fix intermittent test failure in test_current_exceptions
1 parent 6478dea commit 2f59d41

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Lib/test/test_sys.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def test_current_exceptions(self):
511511
# Spawn a thread that blocks at a known place. Then the main
512512
# thread does sys._current_frames(), and verifies that the frames
513513
# returned make sense.
514-
entered_g = threading.Event()
514+
g_raised = threading.Event()
515515
leave_g = threading.Event()
516516
thread_info = [] # the thread's id
517517

@@ -520,22 +520,19 @@ def f123():
520520

521521
def g456():
522522
thread_info.append(threading.get_ident())
523-
entered_g.set()
524523
while True:
525524
try:
526525
raise ValueError("oops")
527526
except ValueError:
527+
g_raised.set()
528528
if leave_g.wait(timeout=support.LONG_TIMEOUT):
529529
break
530530

531531
t = threading.Thread(target=f123)
532532
t.start()
533-
entered_g.wait()
533+
g_raised.wait(timeout=support.LONG_TIMEOUT)
534534

535535
try:
536-
# At this point, t has finished its entered_g.set(), although it's
537-
# impossible to guess whether it's still on that line or has moved on
538-
# to its leave_g.wait().
539536
self.assertEqual(len(thread_info), 1)
540537
thread_id = thread_info[0]
541538

0 commit comments

Comments
 (0)