Skip to content

Commit 3971408

Browse files
committed
Add tstate check.
1 parent 510ade1 commit 3971408

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/_testcapimodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,9 +2617,11 @@ test_interp_ensure(PyObject *self, PyObject *unused)
26172617
PyInterpreterRef sub_ref = get_strong_ref();
26182618
PyInterpreterState *subinterp = PyThreadState_GetInterpreter(tstate);
26192619

2620+
assert(PyThreadState_GetUnchecked() == NULL);
26202621
for (int i = 0; i < 10; ++i) {
26212622
int res = PyThreadState_Ensure(ref);
26222623
assert(res == 0);
2624+
assert(PyThreadState_GetUnchecked() != NULL);
26232625
assert(PyInterpreterState_Get() == interp);
26242626
}
26252627

0 commit comments

Comments
 (0)