Skip to content

Commit 450f81e

Browse files
authored
Merge branch 'main' into agent/gh-155504-threadstate-interp
2 parents 72b93f8 + 948fd7e commit 450f81e

197 files changed

Lines changed: 5811 additions & 1595 deletions

File tree

Some content is hidden

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

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ Include/internal/pycore_ast_state.h generated
8080
Include/internal/pycore_opcode.h generated
8181
Include/internal/pycore_opcode_metadata.h generated
8282
Include/internal/pycore_*_generated.h generated
83+
Include/internal/pycore_token.h generated
8384
Include/internal/pycore_uop_ids.h generated
8485
Include/internal/pycore_uop_metadata.h generated
8586
Include/opcode.h generated
8687
Include/opcode_ids.h generated
8788
Include/slots_generated.h generated
88-
Include/token.h generated
8989
Lib/_opcode_metadata.py generated
9090
Lib/idlelib/help.html generated
9191
Lib/keyword.py generated

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ Finally it should be mentioned that Capsules offer additional functionality,
11061106
which is especially useful for memory allocation and deallocation of the pointer
11071107
stored in a Capsule. The details are described in the Python/C API Reference
11081108
Manual in the section :ref:`capsules` and in the implementation of Capsules (files
1109-
:file:`Include/pycapsule.h` and :file:`Objects/pycapsule.c` in the Python source
1109+
:file:`Include/pycapsule.h` and :file:`Objects/capsule.c` in the Python source
11101110
code distribution).
11111111

11121112
.. rubric:: Footnotes

Doc/library/annotationlib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ Functions
235235
annotate functions that support the :attr:`~Format.STRING` format but
236236
do not have access to the code creating the annotations.
237237

238-
For example, this is used to implement the :attr:`~Format.STRING` for
239-
:class:`typing.TypedDict` classes created through the functional syntax:
238+
For example, this is used to implement the :attr:`~Format.STRING` format
239+
for :class:`typing.TypedDict` classes created through the functional syntax:
240240

241241
.. doctest::
242242

Doc/library/compression.zstd.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Compressing and decompressing data in memory
346346
will be set to ``True``.
347347

348348
Attempting to decompress data after the end of a frame will raise a
349-
:exc:`ZstdError`. Any data found after the end of the frame is ignored
349+
:exc:`EOFError`. Any data found after the end of the frame is ignored
350350
and saved in the :attr:`~.unused_data` attribute.
351351

352352
.. attribute:: eof

Doc/library/csv.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,19 @@ The :mod:`!csv` module defines the following classes:
324324

325325
If several combinations fit the sample equally well ---
326326
for example if both ``','`` and ``';'`` split every row consistently ---
327-
the delimiters ``','``, ``'\t'``, ``';'``, ``' '`` and ``':'``
328-
are preferred, in this order,
327+
the delimiters listed in the :attr:`~Sniffer.preferred` attribute
328+
are preferred, in that order,
329329
no matter how many times each of them occurs.
330330

331+
The *lineterminator* parameter is deduced separately,
332+
by a majority vote among the line endings of the sample.
333+
A tie is broken in the order ``'\r\n'``, ``'\n'``, ``'\r'``,
334+
so a sample without a complete line gives ``'\r\n'``.
335+
331336
.. versionchanged:: next
332337
The dialect is now deduced by trial parsing
333338
and the results may differ from those of earlier Python versions.
334-
The *escapechar* parameter can now be detected,
339+
The *escapechar* and *lineterminator* parameters can now be detected,
335340
and the requested *delimiters* are not restricted to ASCII.
336341

337342

@@ -354,6 +359,15 @@ The :mod:`!csv` module defines the following classes:
354359
This method is a rough heuristic and may produce both false positives and
355360
negatives.
356361

362+
The :class:`Sniffer` class has the following attribute:
363+
364+
.. attribute:: preferred
365+
366+
The list of the delimiters preferred for breaking ties,
367+
in the order of preference.
368+
It can be modified.
369+
Its initial value is ``[',', '\t', ';', ' ', ':']``.
370+
357371
An example for :class:`Sniffer` use::
358372

359373
with open('example.csv', newline='') as csvfile:
@@ -377,6 +391,8 @@ The :mod:`!csv` module defines the following constants:
377391
Instructs :class:`writer` objects to only quote those fields which contain
378392
special characters such as *delimiter*, *quotechar*, ``'\r'``, ``'\n'``
379393
or any of the characters in *lineterminator*.
394+
If *doublequote* is :const:`False` and *escapechar* is set,
395+
the *quotechar* is escaped instead of causing the field to be quoted.
380396

381397

382398
.. data:: QUOTE_NONNUMERIC
@@ -481,6 +497,10 @@ Dialects support the following attributes:
481497
On reading, the *escapechar* removes any special meaning from
482498
the following character. It defaults to :const:`None`, which disables escaping.
483499

500+
.. versionchanged:: 3.10
501+
Previously the *escapechar* itself was not escaped,
502+
which lost it on reading.
503+
484504
.. versionchanged:: 3.11
485505
An empty *escapechar* is not allowed.
486506

@@ -528,6 +548,13 @@ Dialects support the following attributes:
528548
When ``True``, raise exception :exc:`Error` on bad CSV input.
529549
The default is ``False``.
530550

551+
Dialects support :func:`copy.replace`,
552+
which returns a copy of the dialect
553+
with the specified formatting parameters replaced.
554+
555+
.. versionchanged:: next
556+
Added support for :func:`copy.replace`.
557+
531558
.. _reader-objects:
532559

533560
Reader Objects

Doc/library/curses.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ Linux and the BSD variants of Unix.
3131
Whenever the documentation mentions a *character string* it can be specified
3232
as a Unicode string or a byte string.
3333

34+
.. note::
35+
36+
Whether curses may be used from several threads
37+
depends on the underlying library and how it was built.
38+
In many implementations, including the default build of ncurses,
39+
the screen state is shared and not thread-safe;
40+
since the blocking and refresh methods
41+
(such as :meth:`~window.getch` and :meth:`~window.refresh`)
42+
release the :term:`GIL`,
43+
unsynchronized use from several threads can then crash the interpreter.
44+
Serialize the calls,
45+
or wrap them in :meth:`window.use` and :meth:`screen.use`.
46+
3447
.. seealso::
3548

3649
Module :mod:`curses.ascii`

Doc/library/email.compat32-message.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Here are the methods of the :class:`Message` class:
9696
text = fp.getvalue()
9797

9898
If the message object contains binary data that is not encoded according
99-
to RFC standards, the non-compliant data will be replaced by unicode
99+
to RFC standards, the non-compliant data will be replaced by Unicode
100100
"unknown character" code points. (See also :meth:`.as_bytes` and
101101
:class:`~email.generator.BytesGenerator`.)
102102

Doc/library/email.contentmanager.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ Currently the email package provides only one concrete content manager,
9696

9797
This content manager provides only a minimum interface beyond that provided
9898
by :class:`~email.message.Message` itself: it deals only with text, raw
99-
byte strings, and :class:`~email.message.Message` objects. Nevertheless, it
99+
bytes, and :class:`~email.message.Message` objects. Nevertheless, it
100100
provides significant advantages compared to the base API: ``get_content`` on
101-
a text part will return a unicode string without the application needing to
101+
a text part will return a string without the application needing to
102102
manually decode it, ``set_content`` provides a rich set of options for
103103
controlling the headers added to a part and controlling the content transfer
104104
encoding, and it enables the use of the various ``add_`` methods, thereby
@@ -111,7 +111,7 @@ Currently the email package provides only one concrete content manager,
111111
parts), or a ``bytes`` object (for all other non-multipart types). Raise
112112
a :exc:`KeyError` if called on a ``multipart``. If the part is a
113113
``text`` part and *errors* is specified, use it as the error handler when
114-
decoding the payload to unicode. The default error handler is
114+
decoding the payload to a string. The default error handler is
115115
``replace``.
116116

117117
.. method:: set_content(msg, <'str'>, subtype="plain", charset='utf-8', \

Doc/library/email.examples.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Here are a few examples of how to use the :mod:`email` package to read, write,
77
and send simple email messages, as well as more complex MIME messages.
88

99
First, let's see how to create and send a simple text message (both the
10-
text content and the addresses may contain unicode characters):
10+
text content and the addresses may contain Unicode characters):
1111

1212
.. literalinclude:: ../includes/email-simple.py
1313

Doc/library/email.header.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ For example::
4949

5050
Notice here how we wanted the :mailheader:`Subject` field to contain a non-ASCII
5151
character? We did this by creating a :class:`Header` instance and passing in
52-
the character set that the byte string was encoded in. When the subsequent
52+
the character set to use when encoding it. When the subsequent
5353
:class:`~email.message.Message` instance was flattened, the :mailheader:`Subject`
5454
field was properly :rfc:`2047` encoded. MIME-aware mail readers would show this
5555
header using the embedded ISO-8859-1 character.
@@ -150,7 +150,7 @@ Here is the :class:`Header` class description:
150150
.. method:: __str__()
151151

152152
Returns an approximation of the :class:`Header` as a string, using an
153-
unlimited line length. All pieces are converted to unicode using the
153+
unlimited line length. All pieces are decoded using the
154154
specified encoding and joined together appropriately. Any pieces with a
155155
charset of ``'unknown-8bit'`` are decoded as ASCII using the ``'replace'``
156156
error handler.

0 commit comments

Comments
 (0)