Skip to content

Commit 0264f63

Browse files
authoredDec 17, 2022
Docs: Use PY_VERSION_HEX for version comparison (#100179)
1 parent 8edcb30 commit 0264f63

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
 

‎Doc/c-api/apiabiversion.rst

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ See :ref:`stable` for a discussion of API and ABI stability across versions.
5858
Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
5959
hexversion ``0x030a00f0``.
6060

61+
Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
62+
6163
This version is also available via the symbol :data:`Py_Version`.
6264

6365
.. c:var:: const unsigned long Py_Version

‎Doc/whatsnew/3.11.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2319,7 +2319,7 @@ Porting to Python 3.11
23192319
can define the following macros and use them throughout
23202320
the code (credit: these were copied from the ``mypy`` codebase)::
23212321

2322-
#if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 8
2322+
#if PY_VERSION_HEX >= 0x03080000
23232323
# define CPy_TRASHCAN_BEGIN(op, dealloc) Py_TRASHCAN_BEGIN(op, dealloc)
23242324
# define CPy_TRASHCAN_END(op) Py_TRASHCAN_END
23252325
#else

0 commit comments

Comments
 (0)