mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-30 03:03:22 +08:00
Avoid using deprecated API in python 3.9
The PyEval_InitThreads() and PyEval_ThreadsInitialized() functions are now deprecated and will be removed in Python 3.11. Calling PyEval_InitThreads() now does nothing. The GIL is initialized by Py_Initialize() since Python 3.7.
This commit is contained in:
parent
f99ff736c2
commit
ae2ee2a4a5
@ -273,7 +273,10 @@ PYBIND11_NOINLINE inline internals &get_internals() {
|
|||||||
auto *&internals_ptr = *internals_pp;
|
auto *&internals_ptr = *internals_pp;
|
||||||
internals_ptr = new internals();
|
internals_ptr = new internals();
|
||||||
#if defined(WITH_THREAD)
|
#if defined(WITH_THREAD)
|
||||||
PyEval_InitThreads();
|
|
||||||
|
#if PY_VERSION_HEX < 0x03090000
|
||||||
|
PyEval_InitThreads();
|
||||||
|
#endif
|
||||||
PyThreadState *tstate = PyThreadState_Get();
|
PyThreadState *tstate = PyThreadState_Get();
|
||||||
#if PY_VERSION_HEX >= 0x03070000
|
#if PY_VERSION_HEX >= 0x03070000
|
||||||
internals_ptr->tstate = PyThread_tss_alloc();
|
internals_ptr->tstate = PyThread_tss_alloc();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user