Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fa1bd9

Browse files
authored
Merge branch 'main' into asyncio-queue-shutdown
2 parents ddc6ad6 + b4fe02f commit 2fa1bd9

317 files changed

Lines changed: 11739 additions & 7003 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/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ jobs:
514514
strategy:
515515
fail-fast: false
516516
matrix:
517-
# sanitizer: [address, undefined, memory] -- memory skipped temporarily until GH-116886 is solved.
518-
sanitizer: [address, undefined]
517+
sanitizer: [address, undefined, memory]
519518
steps:
520519
- name: Build fuzzers (${{ matrix.sanitizer }})
521520
id: build

.github/workflows/jit.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ on:
55
- '**jit**'
66
- 'Python/bytecodes.c'
77
- 'Python/optimizer*.c'
8-
- 'Python/optimizer_bytecodes.c'
98
push:
109
paths:
1110
- '**jit**'
1211
- 'Python/bytecodes.c'
1312
- 'Python/optimizer*.c'
14-
- 'Python/optimizer_bytecodes.c'
1513
workflow_dispatch:
1614

1715
concurrency:
@@ -22,7 +20,7 @@ jobs:
2220
jit:
2321
name: ${{ matrix.target }} (${{ matrix.debug && 'Debug' || 'Release' }})
2422
runs-on: ${{ matrix.runner }}
25-
timeout-minutes: 60
23+
timeout-minutes: 75
2624
strategy:
2725
fail-fast: false
2826
matrix:
@@ -95,7 +93,7 @@ jobs:
9593
run: |
9694
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
9795
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
98-
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
96+
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
9997
10098
# No PGO or tests (yet):
10199
- name: Emulated Windows
@@ -111,7 +109,7 @@ jobs:
111109
SDKROOT="$(xcrun --show-sdk-path)" \
112110
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
113111
make all --jobs 4
114-
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
112+
./python.exe -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
115113
116114
- name: Native Linux
117115
if: runner.os == 'Linux' && matrix.architecture == 'x86_64'
@@ -120,7 +118,7 @@ jobs:
120118
export PATH="$(llvm-config-${{ matrix.llvm }} --bindir):$PATH"
121119
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }}
122120
make all --jobs 4
123-
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
121+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3
124122
125123
- name: Emulated Linux
126124
if: runner.os == 'Linux' && matrix.architecture != 'x86_64'
@@ -140,4 +138,4 @@ jobs:
140138
HOSTRUNNER=qemu-${{ matrix.architecture }} \
141139
./configure --enable-experimental-jit ${{ matrix.debug && '--with-pydebug' || '--enable-optimizations --with-lto' }} --build=x86_64-linux-gnu --host="$HOST" --with-build-python=../build/bin/python3 --with-pkg-config=no ac_cv_buggy_getaddrinfo=no ac_cv_file__dev_ptc=no ac_cv_file__dev_ptmx=yes
142140
make all --jobs 4
143-
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
141+
./python -m test --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 4500 --verbose2 --verbose3

.github/workflows/project-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- { project: 32, label: sprint }
2424

2525
steps:
26-
- uses: actions/add-to-project@v0.6.0
26+
- uses: actions/add-to-project@v1.0.0
2727
with:
2828
project-url: https://github.com/orgs/python/projects/${{ matrix.project }}
2929
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}

Doc/includes/wasm-ios-notavail.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. include for modules that don't work on WASM or iOS
2+
3+
.. availability:: not WASI, not iOS.
4+
5+
This module does not work or is not available on WebAssembly platforms, or
6+
on iOS. See :ref:`wasm-availability` for more information on WASM
7+
availability; see :ref:`iOS-availability` for more information on iOS
8+
availability.

Doc/includes/wasm-notavail.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.. include for modules that don't work on WASM
22
3-
.. availability:: not Emscripten, not WASI.
3+
.. availability:: not WASI.
44

5-
This module does not work or is not available on WebAssembly platforms
6-
``wasm32-emscripten`` and ``wasm32-wasi``. See
5+
This module does not work or is not available on WebAssembly. See
76
:ref:`wasm-availability` for more information.

Doc/library/asyncio-task.rst

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -867,19 +867,50 @@ Waiting Primitives
867867

868868
.. function:: as_completed(aws, *, timeout=None)
869869

870-
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws*
871-
iterable concurrently. Return an iterator of coroutines.
872-
Each coroutine returned can be awaited to get the earliest next
873-
result from the iterable of the remaining awaitables.
874-
875-
Raises :exc:`TimeoutError` if the timeout occurs before
876-
all Futures are done.
877-
878-
Example::
879-
880-
for coro in as_completed(aws):
881-
earliest_result = await coro
882-
# ...
870+
Run :ref:`awaitable objects <asyncio-awaitables>` in the *aws* iterable
871+
concurrently. The returned object can be iterated to obtain the results
872+
of the awaitables as they finish.
873+
874+
The object returned by ``as_completed()`` can be iterated as an
875+
:term:`asynchronous iterator` or a plain :term:`iterator`. When asynchronous
876+
iteration is used, the originally-supplied awaitables are yielded if they
877+
are tasks or futures. This makes it easy to correlate previously-scheduled
878+
tasks with their results. Example::
879+
880+
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
881+
ipv6_connect = create_task(open_connection("::1", 80))
882+
tasks = [ipv4_connect, ipv6_connect]
883+
884+
async for earliest_connect in as_completed(tasks):
885+
# earliest_connect is done. The result can be obtained by
886+
# awaiting it or calling earliest_connect.result()
887+
reader, writer = await earliest_connect
888+
889+
if earliest_connect is ipv6_connect:
890+
print("IPv6 connection established.")
891+
else:
892+
print("IPv4 connection established.")
893+
894+
During asynchronous iteration, implicitly-created tasks will be yielded for
895+
supplied awaitables that aren't tasks or futures.
896+
897+
When used as a plain iterator, each iteration yields a new coroutine that
898+
returns the result or raises the exception of the next completed awaitable.
899+
This pattern is compatible with Python versions older than 3.13::
900+
901+
ipv4_connect = create_task(open_connection("127.0.0.1", 80))
902+
ipv6_connect = create_task(open_connection("::1", 80))
903+
tasks = [ipv4_connect, ipv6_connect]
904+
905+
for next_connect in as_completed(tasks):
906+
# next_connect is not one of the original task objects. It must be
907+
# awaited to obtain the result value or raise the exception of the
908+
# awaitable that finishes next.
909+
reader, writer = await next_connect
910+
911+
A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables
912+
are done. This is raised by the ``async for`` loop during asynchronous
913+
iteration or by the coroutines yielded during plain iteration.
883914

884915
.. versionchanged:: 3.10
885916
Removed the *loop* parameter.
@@ -891,6 +922,10 @@ Waiting Primitives
891922
.. versionchanged:: 3.12
892923
Added support for generators yielding tasks.
893924

925+
.. versionchanged:: 3.13
926+
The result can now be used as either an :term:`asynchronous iterator`
927+
or as a plain :term:`iterator` (previously it was only a plain iterator).
928+
894929

895930
Running in Threads
896931
==================

Doc/library/configparser.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,11 @@ may be treated as parts of multiline values or ignored.
274274
By default, a valid section name can be any string that does not contain '\\n'.
275275
To change this, see :attr:`ConfigParser.SECTCRE`.
276276

277+
The first section name may be omitted if the parser is configured to allow an
278+
unnamed top level section with ``allow_unnamed_section=True``. In this case,
279+
the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in
280+
``config[UNNAMED_SECTION]``.
281+
277282
Configuration files may include comments, prefixed by specific
278283
characters (``#`` and ``;`` by default [1]_). Comments may appear on
279284
their own on an otherwise empty line, possibly indented. [1]_
@@ -325,6 +330,27 @@ For example:
325330
# Did I mention we can indent comments, too?
326331
327332
333+
.. _unnamed-sections:
334+
335+
Unnamed Sections
336+
----------------
337+
338+
The name of the first section (or unique) may be omitted and values
339+
retrieved by the :const:`UNNAMED_SECTION` attribute.
340+
341+
.. doctest::
342+
343+
>>> config = """
344+
... option = value
345+
...
346+
... [ Section 2 ]
347+
... another = val
348+
... """
349+
>>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)
350+
>>> unnamed.read_string(config)
351+
>>> unnamed.get(configparser.UNNAMED_SECTION, 'option')
352+
'value'
353+
328354
Interpolation of values
329355
-----------------------
330356

@@ -1216,6 +1242,11 @@ ConfigParser Objects
12161242
names is stripped before :meth:`optionxform` is called.
12171243

12181244

1245+
.. data:: UNNAMED_SECTION
1246+
1247+
A special object representing a section name used to reference the unnamed section (see :ref:`unnamed-sections`).
1248+
1249+
12191250
.. data:: MAX_INTERPOLATION_DEPTH
12201251

12211252
The maximum depth for recursive interpolation for :meth:`~configparser.ConfigParser.get` when the *raw*

Doc/library/curses.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ for Windows, DOS, and possibly other systems as well. This extension module is
2121
designed to match the API of ncurses, an open-source curses library hosted on
2222
Linux and the BSD variants of Unix.
2323

24+
.. include:: ../includes/wasm-ios-notavail.rst
25+
2426
.. note::
2527

2628
Whenever the documentation mentions a *character* it can be specified

Doc/library/datetime.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,24 @@ Other constructors, all class methods:
10791079
time tuple. See also :ref:`strftime-strptime-behavior` and
10801080
:meth:`datetime.fromisoformat`.
10811081

1082+
.. versionchanged:: 3.13
1083+
1084+
If *format* specifies a day of month without a year a
1085+
:exc:`DeprecationWarning` is now emitted. This is to avoid a quadrennial
1086+
leap year bug in code seeking to parse only a month and day as the
1087+
default year used in absence of one in the format is not a leap year.
1088+
Such *format* values may raise an error as of Python 3.15. The
1089+
workaround is to always include a year in your *format*. If parsing
1090+
*date_string* values that do not have a year, explicitly add a year that
1091+
is a leap year before parsing:
1092+
1093+
.. doctest::
1094+
1095+
>>> from datetime import datetime
1096+
>>> date_string = "02/29"
1097+
>>> when = datetime.strptime(f"{date_string};1984", "%m/%d;%Y") # Avoids leap year bug.
1098+
>>> when.strftime("%B %d") # doctest: +SKIP
1099+
'February 29'
10821100

10831101

10841102
Class attributes:
@@ -2657,6 +2675,25 @@ Notes:
26572675
for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, ``%j``, ``%U``,
26582676
``%W``, and ``%V``. Format ``%y`` does require a leading zero.
26592677

2678+
(10)
2679+
When parsing a month and day using :meth:`~.datetime.strptime`, always
2680+
include a year in the format. If the value you need to parse lacks a year,
2681+
append an explicit dummy leap year. Otherwise your code will raise an
2682+
exception when it encounters leap day because the default year used by the
2683+
parser is not a leap year. Users run into this bug every four years...
2684+
2685+
.. doctest::
2686+
2687+
>>> month_day = "02/29"
2688+
>>> datetime.strptime(f"{month_day};1984", "%m/%d;%Y") # No leap year bug.
2689+
datetime.datetime(1984, 2, 29, 0, 0)
2690+
2691+
.. deprecated-removed:: 3.13 3.15
2692+
:meth:`~.datetime.strptime` calls using a format string containing
2693+
a day of month without a year now emit a
2694+
:exc:`DeprecationWarning`. In 3.15 or later we may change this into
2695+
an error or change the default year to a leap year. See :gh:`70647`.
2696+
26602697
.. rubric:: Footnotes
26612698

26622699
.. [#] If, that is, we ignore the effects of Relativity

Doc/library/dbm.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There
1919
is a `third party interface <https://www.jcea.es/programacion/pybsddb.htm>`_ to
2020
the Oracle Berkeley DB.
2121

22+
.. include:: ../includes/wasm-ios-notavail.rst
2223

2324
.. exception:: error
2425

@@ -455,4 +456,3 @@ The :mod:`!dbm.dumb` module defines the following:
455456
.. method:: dumbdbm.close()
456457

457458
Close the database.
458-

0 commit comments

Comments
 (0)