From 71307206a8f9d7419c81590ce28ffd61ccd6cbd8 Mon Sep 17 00:00:00 2001 From: Chris Hurley Date: Sat, 1 Nov 2025 15:46:21 -0700 Subject: [PATCH] Fix thread init for Python 3.9+ --- PyScModule.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/PyScModule.cpp b/PyScModule.cpp index 948f36c..f574e9f 100644 --- a/PyScModule.cpp +++ b/PyScModule.cpp @@ -20,8 +20,12 @@ scc::PyScModule::PyScModule(PyObject* self, const sc_core::sc_module_name& nm) : sc_core::sc_module(nm) , self(self) { - if (! PyEval_ThreadsInitialized()) +#if PY_VERSION_HEX < 0x03090000 + if (!PyEval_ThreadsInitialized()) PyEval_InitThreads(); +#else + PyEval_InitThreads(); +#endif Py_INCREF(self); }