1 .. highlightlang:: c 2 3 .. _apiabiversion: 4 5 *********************** 6 API and ABI Versioning 7 *********************** 8 9 ``PY_VERSION_HEX`` is the Python version number encoded in a single integer. 10 11 For example if the ``PY_VERSION_HEX`` is set to ``0x030401a2``, the underlying 12 version information can be found by treating it as a 32 bit number in 13 the following manner: 14 15 +-------+-------------------------+------------------------------------------------+ 16 | Bytes | Bits (big endian order) | Meaning | 17 +=======+=========================+================================================+ 18 | ``1`` | ``1-8`` | ``PY_MAJOR_VERSION`` (the ``3`` in | 19 | | | ``3.4.1a2``) | 20 +-------+-------------------------+------------------------------------------------+ 21 | ``2`` | ``9-16`` | ``PY_MINOR_VERSION`` (the ``4`` in | 22 | | | ``3.4.1a2``) | 23 +-------+-------------------------+------------------------------------------------+ 24 | ``3`` | ``17-24`` | ``PY_MICRO_VERSION`` (the ``1`` in | 25 | | | ``3.4.1a2``) | 26 +-------+-------------------------+------------------------------------------------+ 27 | ``4`` | ``25-28`` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | 28 | | | ``0xB`` for beta, ``0xC`` for release | 29 | | | candidate and ``0xF`` for final), in this | 30 | | | case it is alpha. | 31 +-------+-------------------------+------------------------------------------------+ 32 | | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in | 33 | | | ``3.4.1a2``, zero for final releases) | 34 +-------+-------------------------+------------------------------------------------+ 35 36 Thus ``3.4.1a2`` is hexversion ``0x030401a2``. 37 38 All the given macros are defined in :source:`Include/patchlevel.h`. 39 40