|
@@ -41,17 +41,18 @@ PythonCallbackObject(PyObject *function) {
|
|
|
|
|
|
|
|
set_function(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.
|
|
// 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
|
|
#if PY_VERSION_HEX >= 0x03020000
|
|
|
Py_Initialize();
|
|
Py_Initialize();
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#if PY_VERSION_HEX < 0x03090000
|
|
|
|
|
+ // PyEval_InitThreads is now a deprecated no-op in Python 3.9+
|
|
|
PyEval_InitThreads();
|
|
PyEval_InitThreads();
|
|
|
-#endif
|
|
|
|
|
-#endif
|
|
|
|
|
|
|
+#endif // PY_VERSION_HEX
|
|
|
|
|
+#endif // WITH_THREAD
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|