diff -r 688e721f79d4 Doc/c-api/apiabiversion.rst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Doc/c-api/apiabiversion.rst Thu Feb 28 12:33:18 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 688e721f79d4 Doc/c-api/index.rst --- a/Doc/c-api/index.rst Thu Feb 28 08:31:32 2013 +0200 +++ b/Doc/c-api/index.rst Thu Feb 28 12:33:18 2013 +0530 @@ -23,3 +23,4 @@ memory.rst objimpl.rst stable.rst + apiabiversion.rst diff -r 688e721f79d4 Doc/c-api/stable.rst --- a/Doc/c-api/stable.rst Thu Feb 28 08:31:32 2013 +0200 +++ b/Doc/c-api/stable.rst Thu Feb 28 12:33:18 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, diff -r 688e721f79d4 Doc/library/sys.rst --- a/Doc/library/sys.rst Thu Feb 28 08:31:32 2013 +0200 +++ b/Doc/library/sys.rst Thu Feb 28 12:33:18 2013 +0530 @@ -613,29 +613,7 @@ :term:`struct sequence` :data:`sys.version_info` may be used for a more human-friendly encoding of the same information. - The ``hexversion`` is a 32-bit number with the following layout: - - +-------------------------+------------------------------------------------+ - | Bits (big endian order) | Meaning | - +=========================+================================================+ - | :const:`1-8` | ``PY_MAJOR_VERSION`` (the ``2`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`9-16` | ``PY_MINOR_VERSION`` (the ``1`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`17-24` | ``PY_MICRO_VERSION`` (the ``0`` in | - | | ``2.1.0a3``) | - +-------------------------+------------------------------------------------+ - | :const:`25-28` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, | - | | ``0xB`` for beta, ``0xC`` for release | - | | candidate and ``0xF`` for final) | - +-------------------------+------------------------------------------------+ - | :const:`29-32` | ``PY_RELEASE_SERIAL`` (the ``3`` in | - | | ``2.1.0a3``, zero for final releases) | - +-------------------------+------------------------------------------------+ - - Thus ``2.1.0a3`` is hexversion ``0x020100a3``. + More details of ``hexversion`` can be found at :ref:`apiabiversion` .. data:: implementation