cpython_sandbox / Doc / c-api / apiabiversion.rst

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`.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.