mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
Docs: Use PY_VERSION_HEX for version comparison (#100179)
This commit is contained in:
parent
8edcb30c3f
commit
0264f634f7
2 changed files with 3 additions and 1 deletions
|
|
@ -58,6 +58,8 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
|
||||||
Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
|
Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
|
||||||
hexversion ``0x030a00f0``.
|
hexversion ``0x030a00f0``.
|
||||||
|
|
||||||
|
Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
|
||||||
|
|
||||||
This version is also available via the symbol :data:`Py_Version`.
|
This version is also available via the symbol :data:`Py_Version`.
|
||||||
|
|
||||||
.. c:var:: const unsigned long Py_Version
|
.. c:var:: const unsigned long Py_Version
|
||||||
|
|
|
||||||
|
|
@ -2319,7 +2319,7 @@ Porting to Python 3.11
|
||||||
can define the following macros and use them throughout
|
can define the following macros and use them throughout
|
||||||
the code (credit: these were copied from the ``mypy`` codebase)::
|
the code (credit: these were copied from the ``mypy`` codebase)::
|
||||||
|
|
||||||
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
|
#if PY_VERSION_HEX >= 0x03080000
|
||||||
# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)
|
# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)
|
||||||
# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END
|
# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue