File: apiabiversion.rst

package info (click to toggle)
python3.7 3.7.3-2%2Bdeb10u3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 92,344 kB
  • sloc: python: 547,375; ansic: 419,805; sh: 4,593; cpp: 3,449; makefile: 1,772; asm: 1,602; objc: 761; lisp: 502; pascal: 341; javascript: 313; xml: 76; csh: 21
file content (39 lines) | stat: -rw-r--r-- 2,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
.. highlightlang:: c

.. _apiabiversion:

***********************
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:

   +-------+-------------------------+------------------------------------------------+
   | Bytes | Bits (big endian order) | Meaning                                        |
   +=======+=========================+================================================+
   | ``1`` |       ``1-8``           |  ``PY_MAJOR_VERSION`` (the ``3`` in            |
   |       |                         |  ``3.4.1a2``)                                  |
   +-------+-------------------------+------------------------------------------------+
   | ``2`` |       ``9-16``          |  ``PY_MINOR_VERSION`` (the ``4`` in            |
   |       |                         |  ``3.4.1a2``)                                  |
   +-------+-------------------------+------------------------------------------------+
   | ``3`` |       ``17-24``         |  ``PY_MICRO_VERSION`` (the ``1`` in            |
   |       |                         |  ``3.4.1a2``)                                  |
   +-------+-------------------------+------------------------------------------------+
   | ``4`` |       ``25-28``         |  ``PY_RELEASE_LEVEL`` (``0xA`` for alpha,      |
   |       |                         |  ``0xB`` for beta, ``0xC`` for release         |
   |       |                         |  candidate and ``0xF`` for final), in this     |
   |       |                         |  case it is alpha.                             |
   +-------+-------------------------+------------------------------------------------+
   |       |       ``29-32``         |  ``PY_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 :source:`Include/patchlevel.h`.