PySysC icon indicating copy to clipboard operation
PySysC copied to clipboard

PySysC fails on Python ≥3.9 (PyEval_ThreadsInitialized removed)

Open cphurley82 opened this issue 3 months ago • 0 comments

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.

cphurley82 avatar Nov 01 '25 23:11 cphurley82