Skip to content

Commit 6ecdd04

Browse files
committed
Merge branch 'pythongh-117300-current-frames' into nogil-integration
2 parents bf37dcc + 17a405e commit 6ecdd04

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Lib/test/test_sys.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ def g456():
562562
# And the next record must be for g456().
563563
filename, lineno, funcname, sourceline = stack[i+1]
564564
self.assertEqual(funcname, "g456")
565-
self.assertTrue(sourceline.startswith("if leave_g.wait("))
565+
self.assertTrue((sourceline.startswith("if leave_g.wait(") or
566+
sourceline.startswith("g_raised.set()")))
566567
finally:
567568
# Reap the spawned thread.
568569
leave_g.set()

Python/pystate.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,7 @@ _PyThread_CurrentFrames(void)
24182418
* Because these lists can mutate even when the GIL is held, we
24192419
* need to grab head_mutex for the duration.
24202420
*/
2421+
_PyEval_StopTheWorldAll(runtime);
24212422
HEAD_LOCK(runtime);
24222423
PyInterpreterState *i;
24232424
for (i = runtime->interpreters.head; i != NULL; i = i->next) {
@@ -2451,6 +2452,7 @@ _PyThread_CurrentFrames(void)
24512452

24522453
done:
24532454
HEAD_UNLOCK(runtime);
2455+
_PyEval_StartTheWorldAll(runtime);
24542456
return result;
24552457
}
24562458

@@ -2482,6 +2484,7 @@ _PyThread_CurrentExceptions(void)
24822484
* Because these lists can mutate even when the GIL is held, we
24832485
* need to grab head_mutex for the duration.
24842486
*/
2487+
_PyEval_StopTheWorldAll(runtime);
24852488
HEAD_LOCK(runtime);
24862489
PyInterpreterState *i;
24872490
for (i = runtime->interpreters.head; i != NULL; i = i->next) {
@@ -2514,6 +2517,7 @@ _PyThread_CurrentExceptions(void)
25142517

25152518
done:
25162519
HEAD_UNLOCK(runtime);
2520+
_PyEval_StartTheWorldAll(runtime);
25172521
return result;
25182522
}
25192523

0 commit comments

Comments
 (0)