10000 Docs: Use `PY_VERSION_HEX` for version comparison (GH-100179) · python/cpython@bf0a334 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf0a334

Browse files
Docs: Use PY_VERSION_HEX for version comparison (GH-100179)
(cherry picked from commit 0264f63) Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
1 parent 370498b commit bf0a334

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Doc/c-api/apiabiversion.rst

Lines changed: 2 additions & 0 deletions
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

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

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

0 commit comments

Comments
 (0)
0