-
Notifications
You must be signed in to change notification settings - Fork 7
Description
When PySysC is built or imported under Python 3.9+ the import fails with:
AttributeError: module 'cpython' has no attribute 'PyEval_ThreadsInitialized'
PyEval_ThreadsInitialized() was removed in Python 3.9, so the guard in PyScModule.cpp no longer compiles/runs. The package therefore can’t be used on current CPython releases.
Proposed fix
Wrap the legacy PyEval_ThreadsInitialized() check with #if PY_VERSION_HEX < 0x03090000 and always call PyEval_InitThreads() otherwise. This preserves the old behavior on ≤3.8 while allowing ≥3.9 to initialize the GIL correctly.
Reference implementation
I’ve prepared the change here:
- Branch: https://github.com/cphurley82/PySysC/tree/fix-pyeval-init
- PR draft: https://github.com/cphurley82/PySysC/pull/new/fix-pyeval-init
Because contribution requires Accellera membership, I can’t open an upstream PR directly; the above branch shows exactly what’s needed.