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)
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 componentsinto the format used by
Py_VERSION_HEXandPy_LIMITED_API.For example,
Py_PACK_FULL_VERSION(3, 14, 0, 0xA, 1)evaluates to 0x030E00A1.Py_PACK_VERSION(x, y)is shorthand forPy_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:
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 comparePy_VERSION_HEXto a given version (but do nothing forPy_LIMITED_APIor the macro proposed in PEP 743)