Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12] gh-106948: Docs: Disable links for C standard library functions, OS utility functions and system calls (GH-107062) #107154

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
Call :func:`sys.unraisablehook` using the current exception and *obj*
argument.

This utility function prints a warning message to ``sys.stderr`` when an

Check warning on line 83 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: __del__
exception has been set but it is impossible for the interpreter to actually
raise the exception. It is used, for example, when an exception occurs in an
:meth:`__del__` method.
Expand Down Expand Up @@ -108,7 +108,7 @@

.. c:function:: void PyErr_SetString(PyObject *type, const char *message)

This is the most common way to set the error indicator. The first argument

Check warning on line 111 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:data reference target not found: PyExc_RuntimeError
specifies the exception type; it is normally one of the standard exceptions,
e.g. :c:data:`PyExc_RuntimeError`. You need not increment its reference count.
The second argument is an error message; it is decoded from ``'utf-8'``.
Expand Down Expand Up @@ -136,7 +136,7 @@

.. versionadded:: 3.5


Check warning on line 139 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:identifier reference target not found: va_list
.. c:function:: void PyErr_SetNone(PyObject *type)

This is a shorthand for ``PyErr_SetObject(type, Py_None)``.
Expand All @@ -160,10 +160,10 @@

.. index:: single: strerror()

This is a convenience function to raise an exception when a C library function

Check warning on line 163 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:macro reference target not found: EINTR
has returned an error and set the C variable :c:data:`errno`. It constructs a
tuple object whose first item is the integer :c:data:`errno` value and whose
second item is the corresponding error message (gotten from :c:func:`strerror`),
second item is the corresponding error message (gotten from :c:func:`!strerror`),
and then calls ``PyErr_SetObject(type, object)``. On Unix, when the
:c:data:`errno` value is :c:macro:`EINTR`, indicating an interrupted system call,
this calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator,
Expand All @@ -174,7 +174,7 @@

.. c:function:: PyObject* PyErr_SetFromErrnoWithFilenameObject(PyObject *type, PyObject *filenameObject)

Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that if

Check warning on line 177 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:attr reference target not found: filename
*filenameObject* is not ``NULL``, it is passed to the constructor of *type* as
a third parameter. In the case of :exc:`OSError` exception,
this is used to define the :attr:`filename` attribute of the
Expand All @@ -199,7 +199,7 @@

.. c:function:: PyObject* PyErr_SetFromWindowsErr(int ierr)

This is a convenience function to raise :exc:`WindowsError`. If called with

Check warning on line 202 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: GetLastError

Check warning on line 202 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: FormatMessage

Check warning on line 202 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: GetLastError

Check warning on line 202 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: FormatMessage
*ierr* of ``0``, the error code returned by a call to :c:func:`GetLastError`
is used instead. It calls the Win32 function :c:func:`FormatMessage` to retrieve
the Windows description of error code given by *ierr* or :c:func:`GetLastError`,
Expand All @@ -221,7 +221,7 @@

.. c:function:: PyObject* PyErr_SetFromWindowsErrWithFilename(int ierr, const char *filename)

Similar to :c:func:`PyErr_SetFromWindowsErrWithFilenameObject`, but the

Check warning on line 224 in Doc/c-api/exceptions.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

c:func reference target not found: PyErr_SetFromWindowsErrWithFilenameObject
filename is given as a C string. *filename* is decoded from the filesystem
encoding (:func:`os.fsdecode`).

Expand Down
4 changes: 2 additions & 2 deletions Doc/c-api/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ Operating System Utilities
.. c:function:: PyOS_sighandler_t PyOS_getsig(int i)

Return the current signal handler for signal *i*. This is a thin wrapper around
either :c:func:`sigaction` or :c:func:`signal`. Do not call those functions
either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those functions
directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:expr:`void
(\*)(int)`.


.. c:function:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h)

Set the signal handler for signal *i* to be *h*; return the old signal handler.
This is a thin wrapper around either :c:func:`sigaction` or :c:func:`signal`. Do
This is a thin wrapper around either :c:func:`!sigaction` or :c:func:`!signal`. Do
not call those functions directly! :c:type:`PyOS_sighandler_t` is a typedef
alias for :c:expr:`void (\*)(int)`.

Expand Down
18 changes: 18 additions & 0 deletions Doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@
exclude_patterns.append(venvdir + '/*')

nitpick_ignore = [
# Standard C functions
('c:func', 'calloc'),
('c:func', 'dlopen'),
('c:func', 'exec'),
('c:func', 'fcntl'),
('c:func', 'fork'),
('c:func', 'free'),
('c:func', 'gmtime'),
('c:func', 'localtime'),
('c:func', 'main'),
('c:func', 'malloc'),
('c:func', 'printf'),
('c:func', 'realloc'),
('c:func', 'snprintf'),
('c:func', 'sprintf'),
('c:func', 'stat'),
('c:func', 'system'),
('c:func', 'vsnprintf'),
# Standard C types
('c:type', 'FILE'),
('c:type', '__int'),
Expand Down
6 changes: 3 additions & 3 deletions Doc/howto/instrumentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,19 @@ Available static markers

.. object:: function__return(str filename, str funcname, int lineno)

This marker is the converse of :c:func:`function__entry`, and indicates that
This marker is the converse of :c:func:`!function__entry`, and indicates that
execution of a Python function has ended (either via ``return``, or via an
exception). It is only triggered for pure-Python (bytecode) functions.

The arguments are the same as for :c:func:`function__entry`
The arguments are the same as for :c:func:`!function__entry`

.. object:: line(str filename, str funcname, int lineno)

This marker indicates a Python line is about to be executed. It is
the equivalent of line-by-line tracing with a Python profiler. It is
not triggered within C functions.

The arguments are the same as for :c:func:`function__entry`.
The arguments are the same as for :c:func:`!function__entry`.

.. object:: gc__start(int generation)

Expand Down
8 changes: 4 additions & 4 deletions Doc/library/mailbox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
unlock()

Three locking mechanisms are used---dot locking and, if available, the
:c:func:`flock` and :c:func:`lockf` system calls.
:c:func:`!flock` and :c:func:`!lockf` system calls.


.. seealso::
Expand Down Expand Up @@ -588,7 +588,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
unlock()

Three locking mechanisms are used---dot locking and, if available, the
:c:func:`flock` and :c:func:`lockf` system calls. For MH mailboxes, locking
:c:func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking
the mailbox means locking the :file:`.mh_sequences` file and, only for the
duration of any operations that affect them, locking individual message
files.
Expand Down Expand Up @@ -686,7 +686,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
unlock()

Three locking mechanisms are used---dot locking and, if available, the
:c:func:`flock` and :c:func:`lockf` system calls.
:c:func:`!flock` and :c:func:`!lockf` system calls.


.. seealso::
Expand Down Expand Up @@ -737,7 +737,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
unlock()

Three locking mechanisms are used---dot locking and, if available, the
:c:func:`flock` and :c:func:`lockf` system calls.
:c:func:`!flock` and :c:func:`!lockf` system calls.


.. seealso::
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -714,14 +714,14 @@ process and user.

.. function:: getsid(pid, /)

Call the system call :c:func:`getsid`. See the Unix manual for the semantics.
Call the system call :c:func:`!getsid`. See the Unix manual for the semantics.

.. availability:: Unix, not Emscripten, not WASI.


.. function:: setsid()

Call the system call :c:func:`setsid`. See the Unix manual for the semantics.
Call the system call :c:func:`!setsid`. See the Unix manual for the semantics.

.. availability:: Unix, not Emscripten, not WASI.

Expand All @@ -739,7 +739,7 @@ process and user.
.. function:: strerror(code, /)

Return the error message corresponding to the error code in *code*.
On platforms where :c:func:`strerror` returns ``NULL`` when given an unknown
On platforms where :c:func:`!strerror` returns ``NULL`` when given an unknown
error number, :exc:`ValueError` is raised.


Expand Down
42 changes: 21 additions & 21 deletions Doc/library/select.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

--------------

This module provides access to the :c:func:`select` and :c:func:`poll` functions
available in most operating systems, :c:func:`devpoll` available on
Solaris and derivatives, :c:func:`epoll` available on Linux 2.5+ and
:c:func:`kqueue` available on most BSD.
This module provides access to the :c:func:`!select` and :c:func:`!poll` functions
available in most operating systems, :c:func:`!devpoll` available on
Solaris and derivatives, :c:func:`!epoll` available on Linux 2.5+ and
:c:func:`!kqueue` available on most BSD.
Note that on Windows, it only works for sockets; on other operating systems,
it also works for other file types (in particular, on Unix, it works on pipes).
It cannot be used on regular files to determine whether a file has grown since
Expand Down Expand Up @@ -41,10 +41,10 @@ The module defines the following:
polling object; see section :ref:`devpoll-objects` below for the
methods supported by devpoll objects.

:c:func:`devpoll` objects are linked to the number of file
:c:func:`!devpoll` objects are linked to the number of file
descriptors allowed at the time of instantiation. If your program
reduces this value, :c:func:`devpoll` will fail. If your program
increases this value, :c:func:`devpoll` may return an
reduces this value, :c:func:`!devpoll` will fail. If your program
increases this value, :c:func:`!devpoll` may return an
incomplete list of active file descriptors.

The new file descriptor is :ref:`non-inheritable <fd_inheritance>`.
Expand All @@ -62,7 +62,7 @@ The module defines the following:

*sizehint* informs epoll about the expected number of events to be
registered. It must be positive, or ``-1`` to use the default. It is only
used on older systems where :c:func:`epoll_create1` is not available;
used on older systems where :c:func:`!epoll_create1` is not available;
otherwise it has no effect (though its value is still checked).

*flags* is deprecated and completely ignored. However, when supplied, its
Expand Down Expand Up @@ -117,7 +117,7 @@ The module defines the following:

.. function:: select(rlist, wlist, xlist[, timeout])

This is a straightforward interface to the Unix :c:func:`select` system call.
This is a straightforward interface to the Unix :c:func:`!select` system call.
The first three arguments are iterables of 'waitable objects': either
integers representing file descriptors or objects with a parameterless method
named :meth:`~io.IOBase.fileno` returning such an integer:
Expand Down Expand Up @@ -154,7 +154,7 @@ The module defines the following:
.. index:: single: WinSock

File objects on Windows are not acceptable, but sockets are. On Windows,
the underlying :c:func:`select` function is provided by the WinSock
the underlying :c:func:`!select` function is provided by the WinSock
library, and does not handle file descriptors that don't originate from
WinSock.

Expand All @@ -169,7 +169,7 @@ The module defines the following:

The minimum number of bytes which can be written without blocking to a pipe
when the pipe has been reported as ready for writing by :func:`~select.select`,
:func:`poll` or another interface in this module. This doesn't apply
:func:`!poll` or another interface in this module. This doesn't apply
to other kind of file-like objects such as sockets.

This value is guaranteed by POSIX to be at least 512.
Expand All @@ -184,11 +184,11 @@ The module defines the following:
``/dev/poll`` Polling Objects
-----------------------------

Solaris and derivatives have ``/dev/poll``. While :c:func:`select` is
O(highest file descriptor) and :c:func:`poll` is O(number of file
Solaris and derivatives have ``/dev/poll``. While :c:func:`!select` is
O(highest file descriptor) and :c:func:`!poll` is O(number of file
descriptors), ``/dev/poll`` is O(active file descriptors).

``/dev/poll`` behaviour is very close to the standard :c:func:`poll`
``/dev/poll`` behaviour is very close to the standard :c:func:`!poll`
object.


Expand Down Expand Up @@ -222,7 +222,7 @@ object.
implement :meth:`!fileno`, so they can also be used as the argument.

*eventmask* is an optional bitmask describing the type of events you want to
check for. The constants are the same that with :c:func:`poll`
check for. The constants are the same that with :c:func:`!poll`
object. The default value is a combination of the constants :const:`POLLIN`,
:const:`POLLPRI`, and :const:`POLLOUT`.

Expand All @@ -231,7 +231,7 @@ object.
Registering a file descriptor that's already registered is not an
error, but the result is undefined. The appropriate action is to
unregister or modify it first. This is an important difference
compared with :c:func:`poll`.
compared with :c:func:`!poll`.


.. method:: devpoll.modify(fd[, eventmask])
Expand Down Expand Up @@ -376,13 +376,13 @@ Edge and Level Trigger Polling (epoll) Objects
Polling Objects
---------------

The :c:func:`poll` system call, supported on most Unix systems, provides better
The :c:func:`!poll` system call, supported on most Unix systems, provides better
scalability for network servers that service many, many clients at the same
time. :c:func:`poll` scales better because the system call only requires listing
the file descriptors of interest, while :c:func:`select` builds a bitmap, turns
time. :c:func:`!poll` scales better because the system call only requires listing
the file descriptors of interest, while :c:func:`!select` builds a bitmap, turns
on bits for the fds of interest, and then afterward the whole bitmap has to be
linearly scanned again. :c:func:`select` is O(highest file descriptor), while
:c:func:`poll` is O(number of file descriptors).
linearly scanned again. :c:func:`!select` is O(highest file descriptor), while
:c:func:`!poll` is O(number of file descriptors).


.. method:: poll.register(fd[, eventmask])
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/signal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ The :mod:`signal` module defines the following functions:

Note that installing a signal handler with :func:`signal` will reset the
restart behaviour to interruptible by implicitly calling
:c:func:`siginterrupt` with a true *flag* value for the given signal.
:c:func:`!siginterrupt` with a true *flag* value for the given signal.


.. function:: signal(signalnum, handler)
Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Doc/glossary.rst
Doc/howto/curses.rst
Doc/howto/descriptor.rst
Doc/howto/enum.rst
Doc/howto/instrumentation.rst
Doc/howto/isolating-extensions.rst
Doc/howto/logging-cookbook.rst
Doc/howto/logging.rst
Expand Down
6 changes: 3 additions & 3 deletions Doc/whatsnew/2.6.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ changes, or look through the Subversion logs for all the details.
(Contributed by Raymond Hettinger; :issue:`1861`.)

* The :mod:`select` module now has wrapper functions
for the Linux :c:func:`epoll` and BSD :c:func:`kqueue` system calls.
for the Linux :c:func:`!epoll` and BSD :c:func:`!kqueue` system calls.
:meth:`modify` method was added to the existing :class:`poll`
objects; ``pollobj.modify(fd, eventmask)`` takes a file descriptor
or file object and an event mask, modifying the recorded event mask
Expand Down Expand Up @@ -2328,7 +2328,7 @@ changes, or look through the Subversion logs for all the details.
one for reading and one for writing. The writable descriptor
will be passed to :func:`set_wakeup_fd`, and the readable descriptor
will be added to the list of descriptors monitored by the event loop via
:c:func:`select` or :c:func:`poll`.
:c:func:`!select` or :c:func:`!poll`.
On receiving a signal, a byte will be written and the main event loop
will be woken up, avoiding the need to poll.

Expand Down Expand Up @@ -2982,7 +2982,7 @@ Changes to Python's build process and to the C API include:

* Python now must be compiled with C89 compilers (after 19
years!). This means that the Python source tree has dropped its
own implementations of :c:func:`memmove` and :c:func:`strerror`, which
own implementations of :c:func:`!memmove` and :c:func:`!strerror`, which
are in the C89 standard library.

* Python 2.6 can be built with Microsoft Visual Studio 2008 (version
Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/2.7.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ added as a more powerful replacement for the
This means Python now supports three different modules for parsing
command-line arguments: :mod:`getopt`, :mod:`optparse`, and
:mod:`argparse`. The :mod:`getopt` module closely resembles the C
library's :c:func:`getopt` function, so it remains useful if you're writing a
library's :c:func:`!getopt` function, so it remains useful if you're writing a
Python prototype that will eventually be rewritten in C.
:mod:`optparse` becomes redundant, but there are no plans to remove it
because there are many scripts still using it, and there's no
Expand Down
4 changes: 2 additions & 2 deletions Misc/NEWS.d/3.10.0a1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ format string in f-string and :meth:`str.format`.
.. section: Core and Builtins

The implementation of :func:`signal.siginterrupt` now uses
:c:func:`sigaction` (if it is available in the system) instead of the
deprecated :c:func:`siginterrupt`. Patch by Pablo Galindo.
:c:func:`!sigaction` (if it is available in the system) instead of the
deprecated :c:func:`!siginterrupt`. Patch by Pablo Galindo.

..

Expand Down
Loading