Merge pull request #38099 from tchaikov/wip-mgr-python3.9

mgr/PyModuleRegistry: do not call PyEval_InitThreads() on python3.9

Reviewed-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
Kefu Chai 2020-11-17 10:47:07 +08:00 committed by GitHub
commit d5e73a9e93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,13 +60,13 @@ void PyModuleRegistry::init()
}
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();