https://github.com/python/cpython/commit/1932127ec74bf80ccdc2e94dbbec7a18777c4bbc
commit: 1932127ec74bf80ccdc2e94dbbec7a18777c4bbc
branch: main
author: Petr Viktorin <[email protected]>
committer: encukou <[email protected]>
date: 2026-01-09T17:40:07Z
summary:

gh-141004: Document remaining constants from patchlevel.h (GH-143598)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Doc/c-api/apiabiversion.rst
M Doc/c-api/module.rst
M Tools/check-c-api-docs/ignored_c_api.txt

diff --git a/Doc/c-api/apiabiversion.rst b/Doc/c-api/apiabiversion.rst
index 96050f59bd5250..a17329e4ed6032 100644
--- a/Doc/c-api/apiabiversion.rst
+++ b/Doc/c-api/apiabiversion.rst
@@ -34,6 +34,23 @@ See :ref:`stable` for a discussion of API and ABI stability 
across versions.
    This can be ``0xA`` for alpha, ``0xB`` for beta, ``0xC`` for release
    candidate or ``0xF`` for final.
 
+
+   .. c:namespace:: NULL
+   .. c:macro:: PY_RELEASE_LEVEL_ALPHA
+      :no-typesetting:
+   .. c:macro:: PY_RELEASE_LEVEL_BETA
+      :no-typesetting:
+   .. c:macro:: PY_RELEASE_LEVEL_GAMMA
+      :no-typesetting:
+   .. c:macro:: PY_RELEASE_LEVEL_FINAL
+      :no-typesetting:
+
+   For completeness, the values are available as macros:
+   :c:macro:`!PY_RELEASE_LEVEL_ALPHA` (``0xA``),
+   :c:macro:`!PY_RELEASE_LEVEL_BETA` (``0xB``),
+   :c:macro:`!PY_RELEASE_LEVEL_GAMMA` (``0xC``), and
+   :c:macro:`!PY_RELEASE_LEVEL_FINAL` (``0xF``).
+
 .. c:macro:: PY_RELEASE_SERIAL
 
    The ``2`` in ``3.4.1a2``. Zero for final releases.
@@ -46,6 +63,10 @@ See :ref:`stable` for a discussion of API and ABI stability 
across versions.
    Use this for numeric comparisons, for example,
    ``#if PY_VERSION_HEX >= ...``.
 
+.. c:macro:: PY_VERSION
+
+   The Python version as a string, for example, ``"3.4.1a2"``.
+
 
 Run-time version
 ----------------
diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst
index 37c92aeb6dcb38..431151b841ebb6 100644
--- a/Doc/c-api/module.rst
+++ b/Doc/c-api/module.rst
@@ -820,15 +820,18 @@ struct:
    .. versionadded:: 3.5
 
 .. c:macro:: PYTHON_API_VERSION
+             PYTHON_API_STRING
 
-   The C API version. Defined for backwards compatibility.
+   The C API version, as an integer (``1013``) and string (``"1013"``), 
respectively.
+   Defined for backwards compatibility.
 
    Currently, this constant is not updated in new Python versions, and is not
    useful for versioning. This may change in the future.
 
 .. c:macro:: PYTHON_ABI_VERSION
+             PYTHON_ABI_STRING
 
-   Defined as ``3`` for backwards compatibility.
+   Defined as ``3`` and ``"3"``, respectively, for backwards compatibility.
 
    Currently, this constant is not updated in new Python versions, and is not
    useful for versioning. This may change in the future.
diff --git a/Tools/check-c-api-docs/ignored_c_api.txt 
b/Tools/check-c-api-docs/ignored_c_api.txt
index e0b94edf748853..31c920555992bb 100644
--- a/Tools/check-c-api-docs/ignored_c_api.txt
+++ b/Tools/check-c-api-docs/ignored_c_api.txt
@@ -58,14 +58,6 @@ PY_SIZE_MAX
 PY_UINT32_T
 PY_UINT64_T
 PY_ULLONG_MAX
-# patchlevel.h
-PYTHON_ABI_STRING
-PYTHON_API_STRING
-PY_RELEASE_LEVEL_ALPHA
-PY_RELEASE_LEVEL_BETA
-PY_RELEASE_LEVEL_FINAL
-PY_RELEASE_LEVEL_GAMMA
-PY_VERSION
 # unicodeobject.h
 Py_UNICODE_SIZE
 # cpython/methodobject.h

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to