Skip to content

Commit fa2f855

Browse files
Merge remote-tracking branch 'upstream/main' into time-clinic
# Conflicts: # Modules/timemodule.c
2 parents b10998e + bc6749c commit fa2f855

265 files changed

Lines changed: 6689 additions & 1759 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.

.github/workflows/reusable-check-html-ids.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ jobs:
2020
with:
2121
persist-credentials: false
2222
ref: ${{ github.event.pull_request.head.sha }}
23+
- name: 'Downgrade Git'
24+
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
25+
# to avoid "fatal: shallow file has changed since we read it" bug.
26+
# See https://github.com/python/cpython/issues/151365.
27+
run: |
28+
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
29+
git --version
2330
- name: 'Find merge base'
2431
id: merge-base
2532
run: |

.github/workflows/reusable-context.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ jobs:
9090
|| ''
9191
}}
9292
93+
- name: 'Downgrade Git'
94+
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
95+
# to avoid "fatal: shallow file has changed since we read it" bug.
96+
# See https://github.com/python/cpython/issues/151365.
97+
if: github.event_name == 'pull_request'
98+
run: |
99+
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
100+
git --version
101+
93102
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
94103
- name: Fetch commits to get branch diff
95104
if: github.event_name == 'pull_request'

.github/workflows/reusable-docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ jobs:
4747
&& github.event.pull_request.head.sha
4848
|| ''
4949
}}
50+
- name: 'Downgrade Git'
51+
# Temporarily downgrade to 2.43 until 2.55 is in the runner image,
52+
# to avoid "fatal: shallow file has changed since we read it" bug.
53+
# See https://github.com/python/cpython/issues/151365.
54+
if: github.event_name == 'pull_request'
55+
run: |
56+
sudo apt-get install -y --allow-downgrades 'git=1:2.43.*' 'git-man=1:2.43.*'
57+
git --version
5058
# Adapted from https://github.com/actions/checkout/issues/520#issuecomment-1167205721
5159
- name: 'Fetch commits to get branch diff'
5260
if: github.event_name == 'pull_request'

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/ast.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,8 +806,11 @@ Comprehensions
806806
List and set comprehensions, generator expressions, and dictionary
807807
comprehensions. ``elt`` (or ``key`` and ``value``) is a single node
808808
representing the part that will be evaluated for each item.
809+
809810
For dictionary comprehensions using unpacking, for example
810-
``{**item for item in items}``, ``value`` is ``None``,
811+
``{**item for item in items}``, the expression to be expanded goes in
812+
``key`` and ``value`` is ``None``.
813+
811814
``generators`` is a list of :class:`comprehension` nodes.
812815

813816
.. doctest::

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/concurrent.futures.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,18 @@ Executor Objects
6161
The returned iterator raises a :exc:`TimeoutError`
6262
if :meth:`~iterator.__next__` is called and the result isn't available
6363
after *timeout* seconds from the original call to :meth:`Executor.map`.
64-
*timeout* can be an int or a float. If *timeout* is not specified or
64+
*timeout* can be an int or a float.
65+
It cancels all future calls of *fn* and closes the iterator.
66+
If *timeout* is not specified or
6567
``None``, there is no limit to the wait time.
6668

6769
If a *fn* call raises an exception, then that exception will be
6870
raised when its value is retrieved from the iterator.
71+
It does not cancel future calls of *fn*.
72+
73+
The returned iterator has method :meth:`!close` which cancels all
74+
future calls of *fn* and discards the results of already finished calls
75+
if they are available.
6976

7077
When using :class:`ProcessPoolExecutor`, this method chops *iterables*
7178
into a number of chunks which it submits to the pool as separate
@@ -82,6 +89,10 @@ Executor Objects
8289
.. versionchanged:: 3.14
8390
Added the *buffersize* parameter.
8491

92+
.. versionchanged:: next
93+
The returned iterator is no longer automatically closed if a *fn*
94+
call raises an exception.
95+
8596
.. method:: shutdown(wait=True, *, cancel_futures=False)
8697

8798
Signal the executor that it should free any resources that it is using

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`

0 commit comments

Comments
 (0)