Skip to content

PySysC fails on Python ≥3.9 (PyEval_ThreadsInitialized removed) #11

@cphurley82

Description

@cphurley82

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:

Because contribution requires Accellera membership, I can’t open an upstream PR directly; the above branch shows exactly what’s needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions