Skip to content

Py_PACK_VERSION #47

@encukou

Description

@encukou

Please vote for adding macros/functions for easier version handling, as discussed on Discourse:

  • Py_PACK_FULL_VERSION(x, y, z, level, serial) packs a version number from components
    into the format used by Py_VERSION_HEX and Py_LIMITED_API.
    For example, Py_PACK_FULL_VERSION(3, 14, 0, 0xA, 1) evaluates to 0x030E00A1.

  • Py_PACK_VERSION(x, y) is shorthand for Py_PACK_FULL_VERSION(x, y, 0, 0, 0),
    useful because the first two version components often determine ABI
    compatibility.

  • These are primarily macros, but we will export library functions with the same names and functionality, for use in wrappers for non-C languages – for example, Python with ctypes.
    (The macro-style naming means that we do encourage “serious” wrappers to implement them as compile-time constructs, rather than library calls.)

These should go in the limited API.

See the discussion thread for other considered ideas:

  • Alternate names (much bikeshedding was done, with no clear winner)
  • Leaving out Py_PACK_FULL_VERSION (it's useful to explain this in docs, and sometimes in projects like Cython)
  • Py_VERSION_GE(x, y, z) & Py_VERSION_LE(x, y, z) that would directly compare Py_VERSION_HEX to a given version (but do nothing for Py_LIMITED_API or the macro proposed in PEP 743)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions