File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1424,9 +1424,12 @@ static int test_audit_subinterpreter(void)
14241424 PySys_AddAuditHook (_audit_subinterpreter_hook , NULL );
14251425 _testembed_Py_InitializeFromConfig ();
14261426
1427- Py_NewInterpreter ();
1428- Py_NewInterpreter ();
1429- Py_NewInterpreter ();
1427+ PyThreadState * tstate = PyThreadState_Get ();
1428+ for (int i = 0 ; i < 3 ; ++ i )
1429+ {
1430+ Py_EndInterpreter (Py_NewInterpreter ());
1431+ PyThreadState_Swap (tstate );
1432+ }
14301433
14311434 Py_Finalize ();
14321435
Original file line number Diff line number Diff line change @@ -2414,9 +2414,8 @@ Py_NewInterpreter(void)
24142414 return tstate ;
24152415}
24162416
2417- /* Delete an interpreter and its last thread. This requires that the
2418- given thread state is current, that the thread has no remaining
2419- frames, and that it is its interpreter's only remaining thread.
2417+ /* Delete an interpreter. This requires that the given thread state
2418+ is current, and that the thread has no remaining frames.
24202419 It is a fatal error to violate these constraints.
24212420
24222421 (Py_FinalizeEx() doesn't have these constraints -- it zaps
You can’t perform that action at this time.
0 commit comments