diff -r 5aaf6bc1d502 Doc/c-api/apiabiversion.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doc/c-api/apiabiversion.rst Wed Feb 27 16:00:46 2013 +0530 @@ -0,0 +1,42 @@ +.. highlightlang:: c + +.. _apiabiversion: + +*********************** +API and ABI Versioning +*********************** + +``PY_VERSION_HEX`` is the Python version number encoded in a single integer. +If any extension module defines ``PY_LIMITED_API`` as same with ``PY_VERSION_HEX`` +then that module will work on the future Python releases but will fail to load +in the older versions of Python due to missing symbols. + +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: + + +-------------------------+------------------------------------------------+ + | Bits (big endian order) | Meaning | + +=========================+================================================+ + | :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``3`` in | + | | ``3.4.1a2``) | + +-------------------------+------------------------------------------------+ + | :const:`9-16` | ``PY_MINOR_VERSION`` (the ``4`` in | + | | ``3.4.1a2``) | + +-------------------------+------------------------------------------------+ + | :const:`17-24` | ``PY_MICRO_VERSION`` (the ``1`` in | + | | ``3.4.1a2``) | + +-------------------------+------------------------------------------------+ + | :const:`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. | + +-------------------------+------------------------------------------------+ + | :const:`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`. + diff -r 5aaf6bc1d502 Doc/c-api/index.rst --- a/Doc/c-api/index.rst Tue Feb 26 22:52:25 2013 +0100 +++ b/Doc/c-api/index.rst Wed Feb 27 16:00:46 2013 +0530 @@ -23,3 +23,4 @@ memory.rst objimpl.rst stable.rst + apiabiversion.rst diff -r 5aaf6bc1d502 Doc/c-api/stable.rst --- a/Doc/c-api/stable.rst Tue Feb 26 22:52:25 2013 +0100 +++ b/Doc/c-api/stable.rst Wed Feb 27 16:00:46 2013 +0530 @@ -2,9 +2,9 @@ .. _stable: -********************************** -Stable Appliction Binary Interface -********************************** +*********************************** +Stable Application Binary Interface +*********************************** Traditionally, the C API of Python will change with every release. Most changes will be source-compatible, typically by only adding API,