10000 gh-107091: Fix some uses of :func: role (GH-107378) · python/cpython@413ba89 · GitHub
[go: up one dir, main page]

Skip to content

Commit 413ba89

Browse files
gh-107091: Fix some uses of :func: role (GH-107378)
:c:func: or :c:macro: should be used instead.
1 parent 810d5d8 commit 413ba89

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

Doc/whatsnew/2.0.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ extra set of parentheses to pass both values as a tuple: ``L.append( (1,2) )``.
664664

665665
The earlier versions of these methods were more forgiving because they used an
666666
old function in Python's C interface to parse their arguments; 2.0 modernizes
667-
them to use :func:`PyArg_ParseTuple`, the current argument parsing function,
667+
them to use :c:func:`PyArg_ParseTuple`, the current argument parsing function,
668668
which provides more helpful error messages and treats multi-argument calls as
669669
errors. If you absolutely must use 2.0 but can't fix your code, you can edit
670670
:file:`Objects/listobject.c` and define the preprocessor symbol
@@ -766,7 +766,7 @@ file, :file:`Include/pyport.h`.
766766

767767
Vladimir Marangozov's long-awaited malloc restructuring was completed, to make
768768
it easy to have the Python interpreter use a custom allocator instead of C's
769-
standard :func:`malloc`. For documentation, read the comments in
769+
standard :c:func:`malloc`. For documentation, read the comments in
770770
:file:`Include/pymem.h` and :file:`Include/objimpl.h`. For the lengthy
771771
discussions during which the interface was hammered out, see the web archives of
772772
the 'patches' and 'python-dev' lists at python.org.
@@ -794,15 +794,15 @@ are generating Python code would run into this limit. A patch by Charles G.
794794
Waldman raises the limit from ``2**16`` to ``2**32``.
795795

796796
Three new convenience functions intended for adding constants to a module's
797-
dictionary at module initialization time were added: :func:`PyModule_AddObject`,
798-
:func:`PyModule_AddIntConstant`, and :func:`PyModule_AddStringConstant`. Each
797+
dictionary at module initialization time were added: :c:func:`PyModule_AddObject`,
798+
:c:func:`PyModule_AddIntConstant`, and :c:func:`PyModule_AddStringConstant`. Each
799799
of these functions takes a module object, a null-terminated C string containing
800800
the name to be added, and a third argument for the value to be assigned to the
801801
name. This third argument is, respectively, a Python object, a C long, or a C
802802
string.
803803

804-
A wrapper API was added for Unix-style signal handlers. :func:`PyOS_getsig` gets
805-
a signal handler and :func:`PyOS_setsig` will set a new handler.
804+
A wrapper API was added for Unix-style signal handlers. :c:func:`PyOS_getsig` gets
805+
a signal handler and :c:func:`PyOS_setsig` will set a new handler.
806806

807807
.. ======================================================================
808808

Doc/whatsnew/2.1.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -692,22 +692,22 @@ applied, and 136 bugs fixed; both figures are likely to be underestimates. Some
692692
of the more notable changes are:
693693

694694
* A specialized object allocator is now optionally available, that should be
695-
faster than the system :func:`malloc` and have less memory overhead. The
696-
allocator uses C's :func:`malloc` function to get large pools of memory, and
695+
faster than the system :c:func:`malloc` and have less memory overhead. The
696+
allocator uses C's :c:func:`!malloc` function to get large pools of memory, and
697697
then fulfills smaller memory requests from these pools. It can be enabled by
698698
providing the :option:`!--with-pymalloc` option to the :program:`configure`
699699
script; see :file:`Objects/obmalloc.c` for the implementation details.
700700

701701
Authors of C extension modules should test their code with the object allocator
702702
enabled, because some incorrect code may break, causing core dumps at runtime.
703703
There are a bunch of memory allocation functions in Python's C API that have
704-
previously been just aliases for the C library's :func:`malloc` and
705-
:func:`free`, meaning that if you accidentally called mismatched functions, the
704+
previously been just aliases for the C library's :c:func:`malloc` and
705+
:c:func:`free`, meaning that if you accidentally called mismatched functions, the
706706
error wouldn't be noticeable. When the object allocator is enabled, these
707-
functions aren't aliases of :func:`malloc` and :func:`free` any more, and
707+
functions aren't aliases of :c:func:`!malloc` and :c:func:`!free` any more, and
708708
calling the wrong function to free memory will get you a core dump. For
709-
example, if memory was allocated using :func:`PyMem_New`, it has to be freed
710-
using :func:`PyMem_Del`, not :func:`free`. A few modules included with Python
709+
example, if memory was allocated using :c:macro:`PyMem_New`, it has to be freed
710+
using :c:func:`PyMem_Del`, not :c:func:`!free`. A few modules included with Python
711711
fell afoul of this and had to be fixed; doubtless there are more third-party
712712
modules that will have the same problem.
713713

@@ -717,7 +717,7 @@ of the more notable changes are:
717717
complain about its lack of speed, and because it's often been used as a naïve
718718
benchmark. The :meth:`readline` method of file objects has therefore been
719719
rewritten to be much faster. The exact amount of the speedup will vary from
720-
platform to platform depending on how slow the C library's :func:`getc` was, but
720+
platform to platform depending on how slow the C library's :c:func:`!getc` was, but
721721
is around 66%, and potentially much faster on some particular operating systems.
722722
Tim Peters did much of the benchmarking and coding for this change, motivated by
723723
a discussion in comp.lang.python.
@@ -770,7 +770,7 @@ of the more notable changes are:
770770
reorganization done by Jeremy Hylton.
771771

772772
* C extensions which import other modules have been changed to use
773-
:func:`PyImport_ImportModule`, which means that they will use any import hooks
773+
:c:func:`PyImport_ImportModule`, which means that they will use any import hooks
774774
that have been installed. This is also encouraged for third-party extensions
775775
that need to import some other module from C code.
776776

Misc/NEWS.d/3.11.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,7 @@ The documentation now lists which members of C structs are part of the
17991799
.. nonce: FIVe9I
18001800
.. section: Documentation
18011801
1802-
All docstrings in code snippets are now wrapped into :func:`PyDoc_STR` to
1802+
All docstrings in code snippets are now wrapped into :c:macro:`PyDoc_STR` to
18031803
follow the guideline of `PEP 7's Documentation Strings paragraph
18041804
<https://www.python.org/dev/peps/pep-0007/#documentation-strings>`_. Patch
18051805
by Oleg Iarygin.

Misc/NEWS.d/3.12.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ the interpreter.
203203
.. nonce: LYAWlE
204204
.. section: Core and Builtins
205205
206-
Bugfix: :func:`PyFunction_GetAnnotations` should return a borrowed
206+
Bugfix: :c:func:`PyFunction_GetAnnotations` should return a borrowed
207207
reference. It was returning a new reference.
208208

209209
..

Misc/NEWS.d/3.12.0b1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1205,7 +1205,7 @@ the future, it will raise a ``KeyError``.
12051205
12061206
Fixed a bug where :mod:`pdb` crashes when reading source file with different
12071207
encoding by replacing :func:`io.open` with :func:`io.open_code`. The new
1208-
method would also call into the hook set by :func:`PyFile_SetOpenCodeHook`.
1208+
method would also call into the hook set by :c:func:`PyFile_SetOpenCodeHook`.
12091209

12101210
..
12111211

Misc/NEWS.d/3.9.0a1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5686,7 +5686,7 @@ positional argument.
56865686
.. nonce: zrmgki
56875687
.. section: C API
56885688
5689-
Add :func:`PyConfig_SetWideStringList` function.
5689+
Add :c:func:`PyConfig_SetWideStringList` function.
56905690

56915691
..
56925692
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add :func:`PyModule_Add` function: similar to :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals a reference to the value.
1+
Add :c:func:`PyModule_Add` function: similar to 34E4 :c:func:`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals a reference to the value.

0 commit comments

Comments
 (0)
0