[Python-checkins] Docs: Use `PY_VERSION_HEX` for version comparison (GH-100179)
miss-islington
webhook-mailer at python.org
Sat Dec 17 02:49:59 EST 2022
https://github.com/python/cpython/commit/bf0a334c4e46041c5621f0271cb70feef934c501
commit: bf0a334c4e46041c5621f0271cb70feef934c501
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-12-16T23:49:49-08:00
summary:
Docs: Use `PY_VERSION_HEX` for version comparison (GH-100179)
(cherry picked from commit 0264f634f720fbf12afaf1715a53cd1495fbd85b)
Co-authored-by: Hugo van Kemenade <hugovk at users.noreply.github.com>
files:
M Doc/c-api/apiabiversion.rst
M Doc/whatsnew/3.11.rst
diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst
index 85b6e2f37387..62d542966622 100644
--- a/Doc/c-api/apiabiversion.rst
+++ b/Doc/c-api/apiabiversion.rst
@@ -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
hexversion ``0x030a00f0``.
+ Use this for numeric comparisons, e.g. ``#if PY_VERSION_HEX >= ...``.
+
This version is also available via the symbol :data:`Py_Version`.
.. c:var:: const unsigned long Py_Version
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index f09ccb133fbc..4244875f6c69 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -2320,7 +2320,7 @@ Porting to Python 3.11
can define the following macros and use them throughout
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_END(op) Py_TRASHCAN_END
#else
More information about the Python-checkins
mailing list