Toggle navigation

API and ABI Versioning

API and ABI Versioning

PY_VERSION_HEX is the Python version number encoded in a single integer.

For example if the PY_VERSION_HEX is set to 0x030401a2, the underlying version information can be found by treating it as a 32 bit number in the following manner:

BytesBits (big endian order)Meaning
11-8PY_MAJOR_VERSION (the 3 in 3.4.1a2)
29-16PY_MINOR_VERSION (the 4 in 3.4.1a2)
317-24PY_MICRO_VERSION (the 1 in 3.4.1a2)
425-28PY_RELEASE_LEVEL (0xA for alpha, 0xB for beta, 0xC for release candidate and 0xF for final), in this case it is alpha.
29-32PY_RELEASE_SERIAL (the 2 in 3.4.1a2, zero for final releases)

Thus 3.4.1a2 is hexversion 0x030401a2.

All the given macros are defined in Include/patchlevel.h.