PyEval_InitThreads() and PyEval_ThreadsInitialized() are deprecated
since python3.9, and GIL is initialized by Py_Initialize() in python3.9.
so do not call them unless we are using python < 3.9.
see https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
Signed-off-by: Kefu Chai <kchai@redhat.com>
}
PyImport_AppendInittab("ceph_module", PyModule::init_ceph_module);
Py_InitializeEx(0);
-
+#if PY_VERSION_HEX < 0x03090000
// Let CPython know that we will be calling it back from other
// threads in future.
if (! PyEval_ThreadsInitialized()) {
PyEval_InitThreads();
}
-
+#endif
// Drop the GIL and remember the main thread state (current
// thread state becomes NULL)
pMainThreadState = PyEval_SaveThread();