-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
There are two issues to support latest version of Python. Python header include is hard-coded:
PyScModule.cpp:9:30: fatal error: python3.6/Python.h: No such file or directory
9: #include <python3.6/Python.h>
Changing it to the following makes this independent of Python version:
9: #include <Python.h>
In PyScModule constructor, I get the following warnings:
PyScModule.cpp: In constructor ‘scc::PyScModule::PyScModule(PyObject*, const sc_core::sc_module_name&)’:
PyScModule.cpp:22:11: warning: ‘int PyEval_ThreadsInitialized()’ is deprecated (declared at /opt/tools/wh/dtd/RHE64-7/python/3.9.2/include/python3.9/ceval.h:129) [-Wdeprecated-declarations]
if (! PyEval_ThreadsInitialized())
^
PyScModule.cpp:22:37: warning: ‘int PyEval_ThreadsInitialized()’ is deprecated (declared at /opt/tools/wh/dtd/RHE64-7/python/3.9.2/include/python3.9/ceval.h:129) [-Wdeprecated-declarations]
if (! PyEval_ThreadsInitialized())
^
PyScModule.cpp:23:9: warning: ‘void PyEval_InitThreads()’ is deprecated (declared at /opt/tools/wh/dtd/RHE64-7/python/3.9.2/include/python3.9/ceval.h:130) [-Wdeprecated-declarations]
PyEval_InitThreads();
^
PyScModule.cpp:23:28: warning: ‘void PyEval_InitThreads()’ is deprecated (declared at /opt/tools/wh/dtd/RHE64-7/python/3.9.2/include/python3.9/ceval.h:130) [-Wdeprecated-declarations]
PyEval_InitThreads();
PyEval_InitThreads is deprecated since 3.9 and "Changed in version 3.9: The function now does nothing."
https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads
Changing the constructor to the following would get rid of the problem.
scc::PyScModule::PyScModule(PyObject* self, const sc_core::sc_module_name& nm)
: sc_core::sc_module(nm)
, self(self)
{
#if PY_MAJOR_VERSION < 3 || PY_MINOR_VERSION < 7
if (! PyEval_ThreadsInitialized())
PyEval_InitThreads();
#endif
Py_INCREF(self);
}
Metadata
Metadata
Assignees
Labels
No labels