python_dlhandle = dlopen_libpython(RTLD_NOW | RTLD_GLOBAL);
if (!python_dlhandle) WARN("Failed loading libpython symbols into global symbol table");
-#if PY_VERSION_HEX >= 0x03050000
+#if PY_VERSION_HEX > 0x030a0000
+ {
+ PyStatus status;
+ PyConfig config;
+ wchar_t *name;
+
+ /*
+ * Isolated config: Don't override signal handlers - noop on subs calls
+ */
+ PyConfig_InitIsolatedConfig(&config);
+
+ MEM(name = Py_DecodeLocale(main_config.name, NULL));
+ status = PyConfig_SetString(&config, &config.program_name, name);
+ PyMem_RawFree(name);
+ if (PyStatus_Exception(status)) {
+ PyConfig_Clear(&config);
+ return -1;
+ }
+
+ status = Py_InitializeFromConfig(&config);
+ if (PyStatus_Exception(status)) {
+ PyConfig_Clear(&config);
+ return -1;
+ }
+ PyConfig_Clear(&config);
+ }
+#elif PY_VERSION_HEX >= 0x03050000
{
wchar_t *name;
}
#endif
+#if PY_VERSION_HEX <= 0x030a0000
Py_InitializeEx(0); /* Don't override signal handlers - noop on subs calls */
+#if PY_VERSION_HEX <= 0x03060000
PyEval_InitThreads(); /* This also grabs a lock (which we then need to release) */
+#endif
+#endif
main_interpreter = PyThreadState_Get(); /* Store reference to the main interpreter */
}
+#if PY_VERSION_HEX < 0x03090000
rad_assert(PyEval_ThreadsInitialized());
+#endif
/*
* Increment the reference counter