]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-141004: Document remaining constants from patchlevel.h (GH-143598)
authorPetr Viktorin <encukou@gmail.com>
Fri, 9 Jan 2026 17:40:07 +0000 (18:40 +0100)
committerGitHub <noreply@github.com>
Fri, 9 Jan 2026 17:40:07 +0000 (17:40 +0000)
Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/c-api/apiabiversion.rst
Doc/c-api/module.rst
Tools/check-c-api-docs/ignored_c_api.txt

index 96050f59bd52508422651f6d88d52cb0a7720134..a17329e4ed6032be2956cea33ac9a569eb96cf88 100644 (file)
@@ -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
 ----------------
index 37c92aeb6dcb381675c9c014e3df74f34ec9b0c5..431151b841ebb637ae417cd015638e15ca873dff 100644 (file)
@@ -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.
index e0b94edf74885383cd9989633b949fbf77b89720..31c920555992bb388d861b954230609ae1a55fc6 100644 (file)
@@ -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