[Lldb-commits] [lldb] [lldb] Use Py_InitializeFromConfig with Python >= 3.8 (NFC) (PR #114112)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 30 07:04:58 PDT 2024
================
@@ -117,15 +148,22 @@ struct InitializePythonRAII {
PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
}
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 8) || (PY_MAJOR_VERSION > 3)
+ config.install_signal_handlers = 0;
+ Py_InitializeFromConfig(&config);
+ PyConfig_Clear(&config);
+ InitializeThreadsPrivate();
+#else
// Python < 3.2 and Python >= 3.2 reversed the ordering requirements for
// calling `Py_Initialize` and `PyEval_InitThreads`. < 3.2 requires that you
// call `PyEval_InitThreads` first, and >= 3.2 requires that you call it last.
-#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2) || (PY_MAJOR_VERSION > 3)
+#if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 2)
----------------
DavidSpickett wrote:
Yes you're right I was struggling to read the nested ifdefs. This 3.2 code will be removed once the 20 branch happens so it's fine as is.
https://github.com/llvm/llvm-project/pull/114112
More information about the lldb-commits
mailing list