Skip to content

Commit 705da2e

Browse files
[3.13] gh-151941: Fix Sphinx reference warnings in Doc/c-api/ (GH-152044) (GH-154922)
(cherry picked from commit b3be16d) Co-authored-by: Aniket <148300120+Aniketsy@users.noreply.github.com>
1 parent 36db178 commit 705da2e

5 files changed

Lines changed: 22 additions & 13 deletions

File tree

Doc/c-api/exceptions.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,21 @@ Printing and clearing
119119
.. versionadded:: 3.12
120120
121121
122+
.. c:function:: void PyErr_Display(PyObject *unused, PyObject *value, PyObject *tb)
123+
124+
Legacy variant of :c:func:`PyErr_DisplayException`.
125+
126+
Print the exception *value* with its traceback to :data:`sys.stderr`.
127+
If *value* has no traceback set, *tb* is used as its traceback.
128+
The first argument is ignored.
129+
130+
If :data:`sys.stderr` is ``None``, nothing is printed.
131+
If :data:`sys.stderr` is not set, the exception is dumped to the
132+
C ``stderr`` stream instead.
133+
134+
.. deprecated:: 3.12
135+
Use :c:func:`PyErr_DisplayException` instead.
136+
122137
Raising exceptions
123138
==================
124139

Doc/c-api/init_config.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -610,9 +610,9 @@ PyConfig
610610
611611
.. c:member:: wchar_t* base_executable
612612
613-
Python base executable: :data:`sys._base_executable`.
613+
Python base executable: ``sys._base_executable``.
614614
615-
Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable.
615+
Set by the ``__PYVENV_LAUNCHER__`` environment variable.
616616
617617
Set from :c:member:`PyConfig.executable` if ``NULL``.
618618
@@ -1093,7 +1093,7 @@ PyConfig
10931093
10941094
* On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set.
10951095
* If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use
1096-
:envvar:`__PYVENV_LAUNCHER__` environment variable if set.
1096+
``__PYVENV_LAUNCHER__`` environment variable if set.
10971097
* Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and
10981098
non-empty.
10991099
* Otherwise, use ``L"python"`` on Windows, or ``L"python3"`` on other
@@ -1304,8 +1304,7 @@ PyConfig
13041304
13051305
The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse
13061306
order: the last :c:member:`PyConfig.warnoptions` item becomes the first
1307-
item of :data:`warnings.filters` which is checked first (highest
1308-
priority).
1307+
item of ``warnings.filters`` which is checked first (highest priority).
13091308
13101309
The :option:`-W` command line options adds its value to
13111310
:c:member:`~PyConfig.warnoptions`, it can be used multiple times.
@@ -1621,7 +1620,7 @@ initialization, the core feature of :pep:`432`:
16211620
16221621
Private provisional API:
16231622
1624-
* :c:member:`PyConfig._init_main`: if set to ``0``,
1623+
* ``PyConfig._init_main``: if set to ``0``,
16251624
:c:func:`Py_InitializeFromConfig` stops at the "Core" initialization phase.
16261625
16271626
.. c:function:: PyStatus _Py_InitializeMain(void)

Doc/c-api/intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ complete listing.
337337
implemented with ``__builtin_unreachable()`` on GCC in release mode.
338338

339339
A use for ``Py_UNREACHABLE()`` is following a call to a function that
340-
never returns but that is not declared :c:macro:`_Py_NO_RETURN`.
340+
never returns but that is not declared ``_Py_NO_RETURN``.
341341

342342
If a code path is very unlikely code but can be reached under exceptional
343343
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.
10241024
In addition to the reference count debugging described below, extra checks are
10251025
performed, see :ref:`Python Debug Build <debug-build>`.
10261026

1027-
Defining :c:macro:`Py_TRACE_REFS` enables reference tracing
1027+
Defining ``Py_TRACE_REFS`` enables reference tracing
10281028
(see the :option:`configure --with-trace-refs option <--with-trace-refs>`).
10291029
When defined, a circular doubly linked list of active objects is maintained by adding two extra
10301030
fields to every :c:type:`PyObject`. Total allocations are tracked as well. Upon

Doc/tools/.nitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

55
Doc/c-api/float.rst
6-
Doc/c-api/init_config.rst
7-
Doc/c-api/intro.rst
86
Doc/c-api/module.rst
9-
Doc/c-api/stable.rst
107
Doc/library/ast.rst
118
Doc/library/asyncio-extending.rst
129
Doc/library/asyncio-policy.rst

Tools/check-c-api-docs/ignored_c_api.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ Py_FrozenMain
6565
# cpython/unicodeobject.h
6666
PyUnicode_IS_COMPACT
6767
PyUnicode_IS_COMPACT_ASCII
68-
# pythonrun.h
69-
PyErr_Display
7068
# cpython/objimpl.h
7169
PyObject_GET_WEAKREFS_LISTPTR
7270
# cpython/pythonrun.h

0 commit comments

Comments
 (0)