mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Use a counter instead of a Boolean to check for initialized; n calls
to Py_Initialize will be undone by n calls to Py_Uninitialize.
This commit is contained in:
parent
558be283bf
commit
aa61505fd2
2 changed files with 7 additions and 5 deletions
|
@ -168,6 +168,7 @@ main_thread(int port)
|
|||
PyEval_AcquireThread(gtstate);
|
||||
gtstate = NULL;
|
||||
Py_Finalize();
|
||||
Py_Finalize();
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
@ -213,6 +214,7 @@ init_python()
|
|||
if (gtstate)
|
||||
return;
|
||||
Py_Initialize(); /* Initialize the interpreter */
|
||||
Py_Initialize(); /* Initialize the interpreter */
|
||||
PyEval_InitThreads(); /* Create (and acquire) the interpreter lock */
|
||||
gtstate = PyEval_SaveThread(); /* Release the thread state */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue