Skip to content

Cannot use PyStructSequence_UnnamedField before Python 3.11 #3

@moreati

Description

@moreati

This ticket primarily exists to document the situation. CPython versions prior to Python 3.11 do not mark PyStructSequence_UnnamedField as an exported symbol. This means it cannot be used by extension modules.

On macOS this exhibits as

ImportError: dlopen(/Users/alex/src/scanwalk/_scanwalk.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_PyStructSequence_UnnamedField)

on Linux as

ImportError: /home/pi/src/scanwalk/_scanwalk.cpython-39-aarch64-linux-gnu.so: undefined symbol: PyStructSequence_UnnamedField

On Linux you can see the lack of the symbol with

$ readelf -Ws --dyn-syms /usr/lib/aarch64-linux-gnu/libpython3.9.so.1 | grep PyStructSequence_UnnamedField

or the presence

$ readelf -Ws --dyn-syms /usr/lib/aarch64-linux-gnu/libpython3.11.so | grep PyStructSequence_UnnamedField
   579: 0000000000613d30     8 OBJECT  GLOBAL DEFAULT   18 PyStructSequence_UnnamedField

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions