Skip to content

Commit d70a8ad

Browse files
authored
Merge branch 'main' into fastmethodcaller_lazy_vectorcall
2 parents f174256 + ac2d85a commit d70a8ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1978
-1573
lines changed

Doc/c-api/call.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Vectorcall Support API
152152
This is mostly useful to check whether or not *op* supports vectorcall,
153153
which can be done by checking ``PyVectorcall_Function(op) != NULL``.
154154
155-
.. versionadded:: 3.8
155+
.. versionadded:: 3.9
156156
157157
.. c:function:: PyObject* PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict)
158158

Doc/c-api/exceptions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ For convenience, some of these functions will always return a
163163
This is a convenience function to raise an exception when a C library function
164164
has returned an error and set the C variable :c:data:`errno`. It constructs a
165165
tuple object whose first item is the integer :c:data:`errno` value and whose
166-
second item is the corresponding error message (gotten from :c:func:`strerror`),
166+
second item is the corresponding error message (gotten from :c:func:`!strerror`),
167167
and then calls ``PyErr_SetObject(type, object)``. On Unix, when the
168168
:c:data:`errno` value is :c:macro:`EINTR`, indicating an interrupted system call,
169169
this calls :c:func:`PyErr_CheckSignals`, and if that set the error indicator,

Doc/c-api/sys.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ Operating System Utilities
106106
.. c:function:: PyOS_sighandler_t PyOS_getsig(int i)
107107
108108
Return the current signal handler for signal *i*. This is a thin wrapper around
109-
either :c:func:`sigaction` or :c:func:`signal`. Do not call those functions
109+
either :c:func:`!sigaction` or :c:func:`!signal`. Do not call those functions
110110
directly! :c:type:`PyOS_sighandler_t` is a typedef alias for :c:expr:`void
111111
(\*)(int)`.
112112
113113
114114
.. c:function:: PyOS_sighandler_t PyOS_setsig(int i, PyOS_sighandler_t h)
115115
116116
Set the signal handler for signal *i* to be *h*; return the old signal handler.
117-
This is a thin wrapper around either :c:func:`sigaction` or :c:func:`signal`. Do
117+
This is a thin wrapper around either :c:func:`!sigaction` or :c:func:`!signal`. Do
118118
not call those functions directly! :c:type:`PyOS_sighandler_t` is a typedef
119119
alias for :c:expr:`void (\*)(int)`.
120120

Doc/conf.py

+18
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,24 @@
7777
exclude_patterns.append(venvdir + '/*')
7878

7979
nitpick_ignore = [
80+
# Standard C functions
81+
('c:func', 'calloc'),
82+
('c:func', 'dlopen'),
83+
('c:func', 'exec'),
84+
('c:func', 'fcntl'),
85+
('c:func', 'fork'),
86+
('c:func', 'free'),
87+
('c:func', 'gmtime'),
88+
('c:func', 'localtime'),
89+
('c:func', 'main'),
90+
('c:func', 'malloc'),
91+
('c:func', 'printf'),
92+
('c:func', 'realloc'),
93+
('c:func', 'snprintf'),
94+
('c:func', 'sprintf'),
95+
('c:func', 'stat'),
96+
('c:func', 'system'),
97+
('c:func', 'vsnprintf'),
8098
# Standard C types
8199
('c:type', 'FILE'),
82100
('c:type', '__int'),

Doc/howto/clinic.rst

+145-128
Large diffs are not rendered by default.

Doc/howto/instrumentation.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,19 @@ Available static markers
292292

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

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

299-
The arguments are the same as for :c:func:`function__entry`
299+
The arguments are the same as for :c:func:`!function__entry`
300300

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

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

307-
The arguments are the same as for :c:func:`function__entry`.
307+
The arguments are the same as for :c:func:`!function__entry`.
308308

309309
.. object:: gc__start(int generation)
310310

Doc/library/mailbox.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
477477
unlock()
478478

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

482482

483483
.. seealso::
@@ -588,7 +588,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
588588
unlock()
589589

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

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

691691

692692
.. seealso::
@@ -737,7 +737,7 @@ Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
737737
unlock()
738738

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

742742

743743
.. seealso::

Doc/library/os.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -714,14 +714,14 @@ process and user.
714714

715715
.. function:: getsid(pid, /)
716716

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

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

721721

722722
.. function:: setsid()
723723

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

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

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

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

745745

Doc/library/select.rst

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
--------------
88

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

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

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

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

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

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

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

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

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

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

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

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

191-
``/dev/poll`` behaviour is very close to the standard :c:func:`poll`
191+
``/dev/poll`` behaviour is very close to the standard :c:func:`!poll`
192192
object.
193193

194194

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

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

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

236236

237237
.. method:: devpoll.modify(fd[, eventmask])
@@ -376,13 +376,13 @@ Edge and Level Trigger Polling (epoll) Objects
376376
Polling Objects
377377
---------------
378378

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

387387

388388
.. method:: poll.register(fd[, eventmask])

Doc/library/signal.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ The :mod:`signal` module defines the following functions:
562562

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

567567

568568
.. function:: signal(signalnum, handler)

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Doc/glossary.rst
5656
Doc/howto/curses.rst
5757
Doc/howto/descriptor.rst
5858
Doc/howto/enum.rst
59-
Doc/howto/instrumentation.rst
6059
Doc/howto/isolating-extensions.rst
6160
Doc/howto/logging-cookbook.rst
6261
Doc/howto/logging.rst

Doc/tutorial/introduction.rst

+20-20
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,25 @@ and uses the ``j`` or ``J`` suffix to indicate the imaginary part
138138

139139
.. _tut-strings:
140140

141-
Strings
142-
-------
141+
Text
142+
----
143143

144-
Besides numbers, Python can also manipulate strings, which can be expressed
145-
in several ways. They can be enclosed in single quotes (``'...'``) or
146-
double quotes (``"..."``) with the same result [#]_. ``\`` can be used
147-
to escape quotes::
144+
Python can manipulate text (represented by type :class:`str`, so-called
145+
"strings") as well as numbers. This includes characters "``!``", words
146+
"``rabbit``", names "``Paris``", sentences "``Got your back.``", etc.
147+
"``Yay! :)``". They can be enclosed in single quotes (``'...'``) or double
148+
quotes (``"..."``) with the same result [#]_.
148149

149150
>>> 'spam eggs' # single quotes
150151
'spam eggs'
152+
>>> "Paris rabbit got your back :)! Yay!" # double quotes
153+
'Paris rabbit got your back :)! Yay!'
154+
>>> '1975' # digits and numerals enclosed in quotes are also strings
155+
'1975'
156+
157+
To quote a quote, we need to "escape" it, by preceding it with ``\``.
158+
Alternatively, we can use the other type of quotation marks::
159+
151160
>>> 'doesn\'t' # use \' to escape the single quote...
152161
"doesn't"
153162
>>> "doesn't" # ...or use double quotes instead
@@ -159,23 +168,14 @@ to escape quotes::
159168
>>> '"Isn\'t," they said.'
160169
'"Isn\'t," they said.'
161170

162-
In the interactive interpreter, the output string is enclosed in quotes and
163-
special characters are escaped with backslashes. While this might sometimes
164-
look different from the input (the enclosing quotes could change), the two
165-
strings are equivalent. The string is enclosed in double quotes if
166-
the string contains a single quote and no double quotes, otherwise it is
167-
enclosed in single quotes. The :func:`print` function produces a more
168-
readable output, by omitting the enclosing quotes and by printing escaped
169-
and special characters::
171+
In the Python shell, the string definition and output string can look
172+
different. The :func:`print` function produces a more readable output, by
173+
omitting the enclosing quotes and by printing escaped and special characters::
170174

171-
>>> '"Isn\'t," they said.'
172-
'"Isn\'t," they said.'
173-
>>> print('"Isn\'t," they said.')
174-
"Isn't," they said.
175175
>>> s = 'First line.\nSecond line.' # \n means newline
176-
>>> s # without print(), \n is included in the output
176+
>>> s # without print(), special characters are included in the string
177177
'First line.\nSecond line.'
178-
>>> print(s) # with print(), \n produces a new line
178+
>>> print(s) # with print(), special characters are interpreted, so \n produces new line
179179
First line.
180180
Second line.
181181

Doc/whatsnew/2.6.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -2289,7 +2289,7 @@ changes, or look through the Subversion logs for all the details.
22892289
(Contributed by Raymond Hettinger; :issue:`1861`.)
22902290

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

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

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

29882988
* Python 2.6 can be built with Microsoft Visual Studio 2008 (version

Doc/whatsnew/2.7.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ added as a more powerful replacement for the
355355
This means Python now supports three different modules for parsing
356356
command-line arguments: :mod:`getopt`, :mod:`optparse`, and
357357
:mod:`argparse`. The :mod:`getopt` module closely resembles the C
358-
library's :c:func:`getopt` function, so it remains useful if you're writing a
358+
library's :c:func:`!getopt` function, so it remains useful if you're writing a
359359
Python prototype that will eventually be rewritten in C.
360360
:mod:`optparse` becomes redundant, but there are no plans to remove it
361361
because there are many scripts still using it, and there's no

Doc/whatsnew/3.12.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ Important deprecations, removals or restrictions:
8383

8484
* :pep:`623`: Remove wstr from Unicode
8585

86-
* :pep:`632`: Remove the ``distutils`` package
86+
* :pep:`632`: Remove the ``distutils`` package. See
87+
`the migration guide <https://peps.python.org/pep-0632/#migration-advice>`_
88+
for advice on its replacement.
8789

8890
Improved Error Messages
8991
=======================

0 commit comments

Comments
 (0)