mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Issue #12090: backport 79fcd71d0356
This commit is contained in:
parent
988512cfd7
commit
f2c6db5fac
1 changed files with 6 additions and 0 deletions
|
|
@ -17,7 +17,9 @@ void print_subinterp(void)
|
|||
int main(int argc, char *argv[])
|
||||
{
|
||||
PyThreadState *mainstate, *substate;
|
||||
#ifdef WITH_THREAD
|
||||
PyGILState_STATE gilstate;
|
||||
#endif
|
||||
int i, j;
|
||||
|
||||
for (i=0; i<3; i++) {
|
||||
|
|
@ -28,10 +30,12 @@ int main(int argc, char *argv[])
|
|||
Py_Initialize();
|
||||
mainstate = PyThreadState_Get();
|
||||
|
||||
#ifdef WITH_THREAD
|
||||
PyEval_InitThreads();
|
||||
PyEval_ReleaseThread(mainstate);
|
||||
|
||||
gilstate = PyGILState_Ensure();
|
||||
#endif
|
||||
print_subinterp();
|
||||
PyThreadState_Swap(NULL);
|
||||
|
||||
|
|
@ -43,7 +47,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
PyThreadState_Swap(mainstate);
|
||||
print_subinterp();
|
||||
#ifdef WITH_THREAD
|
||||
PyGILState_Release(gilstate);
|
||||
#endif
|
||||
|
||||
PyEval_RestoreThread(mainstate);
|
||||
Py_Finalize();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue