panda: Remove PyEval_InitThreads calls when compiling against Python 3.9+

Cherry-pick from #1053
This commit is contained in:
Daniel 2020-11-19 23:27:46 +02:00 committed by rdb
parent bf59e880c6
commit 4f63ef635d
3 changed files with 11 additions and 10 deletions

View File

@ -72,12 +72,12 @@ PythonTask(PyObject *func_or_coro, const std::string &name) :
__dict__ = PyDict_New();
#ifndef SIMPLE_THREADS
#if !defined(SIMPLE_THREADS) && defined(WITH_THREAD) && PY_VERSION_HEX < 0x03090000
// Ensure that the Python threading system is initialized and ready to go.
#ifdef WITH_THREAD // This symbol defined within Python.h
// WITH_THREAD symbol defined within Python.h
// PyEval_InitThreads is now a deprecated no-op in Python 3.9+
PyEval_InitThreads();
#endif
#endif
}
/**

View File

@ -38,12 +38,12 @@ PythonThread(PyObject *function, PyObject *args,
set_args(args);
#ifndef SIMPLE_THREADS
#if !defined(SIMPLE_THREADS) && defined(WITH_THREAD) && PY_VERSION_HEX < 0x03090000
// Ensure that the Python threading system is initialized and ready to go.
#ifdef WITH_THREAD // This symbol defined within Python.h
// WITH_THREAD symbol defined within Python.h
// PyEval_InitThreads is now a deprecated no-op in Python 3.9+
PyEval_InitThreads();
#endif
#endif
}
/**

View File

@ -41,17 +41,18 @@ PythonCallbackObject(PyObject *function) {
set_function(function);
#ifndef SIMPLE_THREADS
#if !defined(SIMPLE_THREADS) && defined(WITH_THREAD)
// Ensure that the Python threading system is initialized and ready to go.
#ifdef WITH_THREAD // This symbol defined within Python.h
#if PY_VERSION_HEX >= 0x03020000
Py_Initialize();
#endif
#if PY_VERSION_HEX < 0x03090000
// PyEval_InitThreads is now a deprecated no-op in Python 3.9+
PyEval_InitThreads();
#endif
#endif
#endif // PY_VERSION_HEX
#endif // WITH_THREAD
}
/**