[3.13] gh-151941: Fix Sphinx reference warnings in `Doc/c-api/` (GH-152044) (GH-154922)

ZeroIntensity <[email protected]> Thu, 30 Jul 2026 09:13:07 -0400 (EDT)
Newsgroups gmane.comp.python.cvs
Message-ID <[email protected]>
https://github.com/python/cpython/commit/705da2eb7382f85365e3815f220a2344f8de99c6
commit: 705da2eb7382f85365e3815f220a2344f8de99c6
branch: 3.13
author: Peter Bierma <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2026-07-30T09:12:54-04:00
summary:

[3.13] gh-151941: Fix Sphinx reference warnings in `Doc/c-api/` (GH-152044) (GH-154922)

(cherry picked from commit b3be16db02e71368774aab62c8ce3f6fb8cc5452)

Co-authored-by: Aniket <[email protected]>

files:
M Doc/c-api/exceptions.rst
M Doc/c-api/init_config.rst
M Doc/c-api/intro.rst
M Doc/tools/.nitignore
M Tools/check-c-api-docs/ignored_c_api.txt

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index d66826d049820b4..f41e2169cb80f3f 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -119,6 +119,21 @@ Printing and clearing
    .. versionadded:: 3.12
 
 
+.. c:function:: void PyErr_Display(PyObject *unused, PyObject *value, PyObject *tb)
+
+   Legacy variant of :c:func:`PyErr_DisplayException`.
+
+   Print the exception *value* with its traceback to :data:`sys.stderr`.
+   If *value* has no traceback set, *tb* is used as its traceback.
+   The first argument is ignored.
+
+   If :data:`sys.stderr` is ``None``, nothing is printed.
+   If :data:`sys.stderr` is not set, the exception is dumped to the
+   C ``stderr`` stream instead.
+
+   .. deprecated:: 3.12
+      Use :c:func:`PyErr_DisplayException` instead.
+
 Raising exceptions
 ==================
 
diff --git a/Doc/c-api/init_config.rst b/Doc/c-api/init_config.rst
index c34f1e03c875f7b..7053b53537c5552 100644
--- a/Doc/c-api/init_config.rst
+++ b/Doc/c-api/init_config.rst
@@ -610,9 +610,9 @@ PyConfig
 
    .. c:member:: wchar_t* base_executable
 
-      Python base executable: :data:`sys._base_executable`.
+      Python base executable: ``sys._base_executable``.
 
-      Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable.
+      Set by the ``__PYVENV_LAUNCHER__`` environment variable.
 
       Set from :c:member:`PyConfig.executable` if ``NULL``.
 
@@ -1093,7 +1093,7 @@ PyConfig
 
       * On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set.
       * If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use
-        :envvar:`__PYVENV_LAUNCHER__` environment variable if set.
+        ``__PYVENV_LAUNCHER__`` environment variable if set.
       * Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and
         non-empty.
       * Otherwise, use ``L"python"`` on Windows, or ``L"python3"`` on other
@@ -1304,8 +1304,7 @@ PyConfig
 
       The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse
       order: the last :c:member:`PyConfig.warnoptions` item becomes the first
-      item of :data:`warnings.filters` which is checked first (highest
-      priority).
+      item of ``warnings.filters`` which is checked first (highest priority).
 
       The :option:`-W` command line options adds its value to
       :c:member:`~PyConfig.warnoptions`, it can be used multiple times.
@@ -1621,7 +1620,7 @@ initialization, the core feature of :pep:`432`:
 
 Private provisional API:
 
-* :c:member:`PyConfig._init_main`: if set to ``0``,
+* ``PyConfig._init_main``: if set to ``0``,
   :c:func:`Py_InitializeFromConfig` stops at the "Core" initialization phase.
 
 .. c:function:: PyStatus _Py_InitializeMain(void)
diff --git a/Doc/c-api/intro.rst b/Doc/c-api/intro.rst
index 2d3360a5a3bd927..0259d809c6cbe73 100644
--- a/Doc/c-api/intro.rst
+++ b/Doc/c-api/intro.rst
@@ -337,7 +337,7 @@ complete listing.
    implemented with ``__builtin_unreachable()`` on GCC in release mode.
 
    A use for ``Py_UNREACHABLE()`` is following a call to a function that
-   never returns but that is not declared :c:macro:`_Py_NO_RETURN`.
+   never returns but that is not declared ``_Py_NO_RETURN``.
 
    If a code path is very unlikely code but can be reached under exceptional
    case, this macro must not be used.  For example, under low memory condition
@@ -1024,7 +1024,7 @@ in the Unix build, compiler optimization is disabled.
 In addition to the reference count debugging described below, extra checks are
 performed, see :ref:`Python Debug Build <debug-build>`.
 
-Defining :c:macro:`Py_TRACE_REFS` enables reference tracing
+Defining ``Py_TRACE_REFS`` enables reference tracing
 (see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
 When defined, a circular doubly linked list of active objects is maintained by adding two extra
 fields to every :c:type:`PyObject`.  Total allocations are tracked as well.  Upon
diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore
index bb701c3a7be86ca..a6495dc3cc5ad98 100644
--- a/Doc/tools/.nitignore
+++ b/Doc/tools/.nitignore
@@ -3,10 +3,7 @@
 # Keep lines sorted lexicographically to help avoid merge conflicts.
 
 Doc/c-api/float.rst
-Doc/c-api/init_config.rst
-Doc/c-api/intro.rst
 Doc/c-api/module.rst
-Doc/c-api/stable.rst
 Doc/library/ast.rst
 Doc/library/asyncio-extending.rst
 Doc/library/asyncio-policy.rst
diff --git a/Tools/check-c-api-docs/ignored_c_api.txt b/Tools/check-c-api-docs/ignored_c_api.txt
index abb61a972129d29..c74fbcfbb063bbf 100644
--- a/Tools/check-c-api-docs/ignored_c_api.txt
+++ b/Tools/check-c-api-docs/ignored_c_api.txt
@@ -65,8 +65,6 @@ Py_FrozenMain
 # cpython/unicodeobject.h
 PyUnicode_IS_COMPACT
 PyUnicode_IS_COMPACT_ASCII
-# pythonrun.h
-PyErr_Display
 # cpython/objimpl.h
 PyObject_GET_WEAKREFS_LISTPTR
 # cpython/pythonrun.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]