# Spawn a thread that blocks at a known place. Then the main
# thread does sys._current_frames(), and verifies that the frames
# returned make sense.
- entered_g = threading.Event()
+ g_raised = threading.Event()
leave_g = threading.Event()
thread_info = [] # the thread's id
def g456():
thread_info.append(threading.get_ident())
- entered_g.set()
while True:
try:
raise ValueError("oops")
except ValueError:
+ g_raised.set()
if leave_g.wait(timeout=support.LONG_TIMEOUT):
break
t = threading.Thread(target=f123)
t.start()
- entered_g.wait()
+ g_raised.wait(timeout=support.LONG_TIMEOUT)
try:
- # At this point, t has finished its entered_g.set(), although it's
- # impossible to guess whether it's still on that line or has moved on
- # to its leave_g.wait().
self.assertEqual(len(thread_info), 1)
thread_id = thread_info[0]