Skip to content

Commit 912ebc1

Browse files
authored
Merge branch 'main' into incremental-gc-3
2 parents 7febe8e + a29998a commit 912ebc1

File tree

87 files changed

+1842
-743
lines changed

Some content is hidden

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

87 files changed

+1842
-743
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ENV WASI_SDK_VERSION=20
66
ENV WASI_SDK_PATH=/opt/wasi-sdk
77

88
ENV WASMTIME_HOME=/opt/wasmtime
9-
ENV WASMTIME_VERSION=14.0.4
9+
ENV WASMTIME_VERSION=18.0.2
1010
ENV WASMTIME_CPU_ARCH=x86_64
1111

1212
RUN dnf -y --nodocs --setopt=install_weak_deps=False install /usr/bin/{blurb,clang,curl,git,ln,tar,xz} 'dnf-command(builddep)' && \

.github/workflows/jit.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
target:
3030
- i686-pc-windows-msvc/msvc
3131
- x86_64-pc-windows-msvc/msvc
32+
- aarch64-pc-windows-msvc/msvc
3233
- x86_64-apple-darwin/clang
3334
- aarch64-apple-darwin/clang
3435
- x86_64-unknown-linux-gnu/gcc
@@ -49,6 +50,10 @@ jobs:
4950
architecture: x64
5051
runner: windows-latest
5152
compiler: msvc
53+
- target: aarch64-pc-windows-msvc/msvc
54+
architecture: ARM64
55+
runner: windows-latest
56+
compiler: msvc
5257
- target: x86_64-apple-darwin/clang
5358
architecture: x86_64
5459
runner: macos-13
@@ -85,14 +90,21 @@ jobs:
8590
with:
8691
python-version: '3.11'
8792

88-
- name: Windows
89-
if: runner.os == 'Windows'
93+
- name: Native Windows
94+
if: runner.os == 'Windows' && matrix.architecture != 'ARM64'
9095
run: |
9196
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
9297
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '--pgo' }} -p ${{ matrix.architecture }}
9398
./PCbuild/rt.bat ${{ matrix.debug && '-d' }} -p ${{ matrix.architecture }} -q --exclude ${{ matrix.exclude }} --multiprocess 0 --timeout 3600 --verbose2 --verbose3
9499
95-
- name: macOS
100+
# No PGO or tests (yet):
101+
- name: Emulated Windows
102+
if: runner.os == 'Windows' && matrix.architecture == 'ARM64'
103+
run: |
104+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}
105+
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
106+
107+
- name: Native macOS
96108
if: runner.os == 'macOS'
97109
run: |
98110
brew install llvm@${{ matrix.llvm }}

Doc/faq/general.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ Python versions are numbered "A.B.C" or "A.B":
133133
changes.
134134
* *C* is the micro version number -- it is incremented for each bugfix release.
135135

136-
See :pep:`6` for more information about bugfix releases.
137-
138136
Not all releases are bugfix releases. In the run-up to a new feature release, a
139137
series of development releases are made, denoted as alpha, beta, or release
140138
candidate. Alphas are early releases in which interfaces aren't yet finalized;
@@ -157,7 +155,11 @@ unreleased versions, built directly from the CPython development repository. In
157155
practice, after a final minor release is made, the version is incremented to the
158156
next minor version, which becomes the "a0" version, e.g. "2.4a0".
159157

160-
See also the documentation for :data:`sys.version`, :data:`sys.hexversion`, and
158+
See the `Developer's Guide
159+
<https://devguide.python.org/developer-workflow/development-cycle/>`__
160+
for more information about the development cycle, and
161+
:pep:`387` to learn more about Python's backward compatibility policy. See also
162+
the documentation for :data:`sys.version`, :data:`sys.hexversion`, and
161163
:data:`sys.version_info`.
162164

163165

Doc/library/asyncio-stream.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ StreamWriter
347347
be resumed. When there is nothing to wait for, the :meth:`drain`
348348
returns immediately.
349349

350-
.. coroutinemethod:: start_tls(sslcontext, \*, server_hostname=None, \
350+
.. coroutinemethod:: start_tls(sslcontext, *, server_hostname=None, \
351351
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
352352

353353
Upgrade an existing stream-based connection to TLS.

Doc/library/datetime.rst

+8-2
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,9 @@ Supported operations:
12091209

12101210
Naive and aware :class:`!datetime` objects are never equal.
12111211

1212+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1213+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1214+
the base datetimes are compared.
12121215
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12131216
attributes, the comparison acts as comparands were first converted to UTC
12141217
datetimes except that the implementation never overflows.
@@ -1222,6 +1225,9 @@ Supported operations:
12221225
Order comparison between naive and aware :class:`.datetime` objects
12231226
raises :exc:`TypeError`.
12241227

1228+
If both comparands are aware, and have the same :attr:`!tzinfo` attribute,
1229+
the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and
1230+
the base datetimes are compared.
12251231
If both comparands are aware and have different :attr:`~.datetime.tzinfo`
12261232
attributes, the comparison acts as comparands were first converted to UTC
12271233
datetimes except that the implementation never overflows.
@@ -1778,8 +1784,8 @@ Naive and aware :class:`!time` objects are never equal.
17781784
Order comparison between naive and aware :class:`!time` objects raises
17791785
:exc:`TypeError`.
17801786

1781-
If both comparands are aware, and have
1782-
the same :attr:`~.time.tzinfo` attribute, the common :attr:`!tzinfo` attribute is
1787+
If both comparands are aware, and have the same :attr:`~.time.tzinfo`
1788+
attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are
17831789
ignored and the base times are compared. If both comparands are aware and
17841790
have different :attr:`!tzinfo` attributes, the comparands are first adjusted by
17851791
subtracting their UTC offsets (obtained from ``self.utcoffset()``).

Doc/library/enum.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Data Types
170170
final *enum*, as well as creating the enum members, properly handling
171171
duplicates, providing iteration over the enum class, etc.
172172

173-
.. method:: EnumType.__call__(cls, value, names=None, \*, module=None, qualname=None, type=None, start=1, boundary=None)
173+
.. method:: EnumType.__call__(cls, value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
174174

175175
This method is called in two different ways:
176176

@@ -350,7 +350,7 @@ Data Types
350350
>>> PowersOfThree.SECOND.value
351351
9
352352

353-
.. method:: Enum.__init__(self, \*args, \**kwds)
353+
.. method:: Enum.__init__(self, *args, **kwds)
354354

355355
By default, does nothing. If multiple values are given in the member
356356
assignment, those values become separate arguments to ``__init__``; e.g.
@@ -361,7 +361,7 @@ Data Types
361361

362362
``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, 'Mon')``
363363

364-
.. method:: Enum.__init_subclass__(cls, \**kwds)
364+
.. method:: Enum.__init_subclass__(cls, **kwds)
365365

366366
A *classmethod* that is used to further configure subsequent subclasses.
367367
By default, does nothing.
@@ -388,7 +388,7 @@ Data Types
388388
>>> Build('deBUG')
389389
<Build.DEBUG: 'debug'>
390390

391-
.. method:: Enum.__new__(cls, \*args, \**kwds)
391+
.. method:: Enum.__new__(cls, *args, **kwds)
392392

393393
By default, doesn't exist. If specified, either in the enum class
394394
definition or in a mixin class (such as ``int``), all values given

Doc/library/filecmp.rst

+7-2
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,20 @@ The :mod:`filecmp` module defines the following functions:
7070
The :class:`dircmp` class
7171
-------------------------
7272

73-
.. class:: dircmp(a, b, ignore=None, hide=None)
73+
.. class:: dircmp(a, b, ignore=None, hide=None, shallow=True)
7474

7575
Construct a new directory comparison object, to compare the directories *a*
7676
and *b*. *ignore* is a list of names to ignore, and defaults to
7777
:const:`filecmp.DEFAULT_IGNORES`. *hide* is a list of names to hide, and
7878
defaults to ``[os.curdir, os.pardir]``.
7979

8080
The :class:`dircmp` class compares files by doing *shallow* comparisons
81-
as described for :func:`filecmp.cmp`.
81+
as described for :func:`filecmp.cmp` by default using the *shallow*
82+
parameter.
83+
84+
.. versionchanged:: 3.13
85+
86+
Added the *shallow* parameter.
8287

8388
The :class:`dircmp` class provides the following methods:
8489

Doc/library/hashlib.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ More condensed:
121121
Constructors
122122
------------
123123

124-
.. function:: new(name[, data], \*, usedforsecurity=True)
124+
.. function:: new(name[, data], *, usedforsecurity=True)
125125

126126
Is a generic constructor that takes the string *name* of the desired
127127
algorithm as its first parameter. It also exists to allow access to the

Doc/library/http.server.rst

+6
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,12 @@ the ``--cgi`` option::
520520
:mod:`http.server` command line ``--cgi`` support is being removed
521521
because :class:`CGIHTTPRequestHandler` is being removed.
522522

523+
.. warning::
524+
525+
:class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option
526+
are not intended for use by untrusted clients and may be vulnerable
527+
to exploitation. Always use within a secure environment.
528+
523529
.. _http.server-security:
524530

525531
Security Considerations

Doc/library/itertools.rst

+16-23
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ Iterator Arguments Results
5656
:func:`chain` p, q, ... p0, p1, ... plast, q0, q1, ... ``chain('ABC', 'DEF') --> A B C D E F``
5757
:func:`chain.from_iterable` iterable p0, p1, ... plast, q0, q1, ... ``chain.from_iterable(['ABC', 'DEF']) --> A B C D E F``
5858
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``
59-
:func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
60-
:func:`filterfalse` pred, seq elements of seq where pred(elem) is false ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
59+
:func:`dropwhile` predicate, seq seq[n], seq[n+1], starting when predicate fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
60+
:func:`filterfalse` predicate, seq elements of seq where predicate(elem) fails ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
6161
:func:`groupby` iterable[, key] sub-iterators grouped by value of key(v)
6262
:func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G``
6363
:func:`pairwise` iterable (p[0], p[1]), (p[1], p[2]) ``pairwise('ABCDEFG') --> AB BC CD DE EF FG``
6464
:func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
65-
:func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
65+
:func:`takewhile` predicate, seq seq[0], seq[1], until predicate fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
6666
:func:`tee` it, n it1, it2, ... itn splits one iterator into n
6767
:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
6868
============================ ============================ ================================================= =============================================================
@@ -90,7 +90,7 @@ Examples Results
9090

9191
.. _itertools-functions:
9292

93-
Itertool functions
93+
Itertool Functions
9494
------------------
9595

9696
The following module functions all construct and return iterators. Some provide
@@ -859,27 +859,20 @@ which incur interpreter overhead.
859859
"Returns the nth item or a default value."
860860
return next(islice(iterable, n, None), default)
861861

862-
def quantify(iterable, pred=bool):
862+
def quantify(iterable, predicate=bool):
863863
"Given a predicate that returns True or False, count the True results."
864-
return sum(map(pred, iterable))
864+
return sum(map(predicate, iterable))
865+
866+
def first_true(iterable, default=False, predicate=None):
867+
"Returns the first true value or the *default* if there is no true value."
868+
# first_true([a,b,c], x) --> a or b or c or x
869+
# first_true([a,b], x, f) --> a if f(a) else b if f(b) else x
870+
return next(filter(predicate, iterable), default)
865871

866872
def all_equal(iterable, key=None):
867873
"Returns True if all the elements are equal to each other."
868874
return len(take(2, groupby(iterable, key))) <= 1
869875

870-
def first_true(iterable, default=False, pred=None):
871-
"""Returns the first true value in the iterable.
872-
873-
If no true value is found, returns *default*
874-
875-
If *pred* is not None, returns the first item
876-
for which pred(item) is true.
877-
878-
"""
879-
# first_true([a,b,c], x) --> a or b or c or x
880-
# first_true([a,b], x, f) --> a if f(a) else b if f(b) else x
881-
return next(filter(pred, iterable), default)
882-
883876
def unique_everseen(iterable, key=None):
884877
"List unique elements, preserving order. Remember all elements ever seen."
885878
# unique_everseen('AAAABBBCCDAABBB') --> A B C D
@@ -964,14 +957,14 @@ which incur interpreter overhead.
964957
num_active -= 1
965958
nexts = cycle(islice(nexts, num_active))
966959
967-
def partition(pred, iterable):
960+
def partition(predicate, iterable):
968961
"""Partition entries into false entries and true entries.
969962

970-
If *pred* is slow, consider wrapping it with functools.lru_cache().
963+
If *predicate* is slow, consider wrapping it with functools.lru_cache().
971964
"""
972965
# partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9
973966
t1, t2 = tee(iterable)
974-
return filterfalse(pred, t1), filter(pred, t2)
967+
return filterfalse(predicate, t1), filter(predicate, t2)
975968

976969
def subslices(seq):
977970
"Return all contiguous non-empty subslices of a sequence."
@@ -1214,7 +1207,7 @@ The following recipes have a more mathematical flavor:
12141207
>>> quantify([True, False, False, True, True])
12151208
3
12161209

1217-
>>> quantify(range(12), pred=lambda x: x%2==1)
1210+
>>> quantify(range(12), predicate=lambda x: x%2==1)
12181211
6
12191212

12201213
>>> a = [[1, 2, 3], [4, 5, 6]]

Doc/reference/datamodel.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -1812,12 +1812,15 @@ Basic customization
18121812
rather, :meth:`__lt__` and :meth:`__gt__` are each other's reflection,
18131813
:meth:`__le__` and :meth:`__ge__` are each other's reflection, and
18141814
:meth:`__eq__` and :meth:`__ne__` are their own reflection.
1815-
If the operands are of different types, and right operand's type is
1815+
If the operands are of different types, and the right operand's type is
18161816
a direct or indirect subclass of the left operand's type,
18171817
the reflected method of the right operand has priority, otherwise
18181818
the left operand's method has priority. Virtual subclassing is
18191819
not considered.
18201820

1821+
When no appropriate method returns any value other than :data:`NotImplemented`, the
1822+
``==`` and ``!=`` operators will fall back to ``is`` and ``is not``, respectively.
1823+
18211824
.. method:: object.__hash__(self)
18221825

18231826
.. index::
@@ -3044,10 +3047,12 @@ left undefined.
30443047
(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``,
30453048
``>>=``, ``&=``, ``^=``, ``|=``). These methods should attempt to do the
30463049
operation in-place (modifying *self*) and return the result (which could be,
3047-
but does not have to be, *self*). If a specific method is not defined, the
3050+
but does not have to be, *self*). If a specific method is not defined, or if
3051+
that method returns :data:`NotImplemented`, the
30483052
augmented assignment falls back to the normal methods. For instance, if *x*
30493053
is an instance of a class with an :meth:`__iadd__` method, ``x += y`` is
3050-
equivalent to ``x = x.__iadd__(y)`` . Otherwise, ``x.__add__(y)`` and
3054+
equivalent to ``x = x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, or if ``x.__iadd__(y)``
3055+
returns :data:`!NotImplemented`, ``x.__add__(y)`` and
30513056
``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In
30523057
certain situations, augmented assignment can result in unexpected errors (see
30533058
:ref:`faq-augmented-assignment-tuple-error`), but this behavior is in fact

Doc/tutorial/introduction.rst

+24-7
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,6 @@ indexed and sliced::
405405
>>> squares[-3:] # slicing returns a new list
406406
[9, 16, 25]
407407

408-
All slice operations return a new list containing the requested elements. This
409-
means that the following slice returns a
410-
:ref:`shallow copy <shallow_vs_deep_copy>` of the list::
411-
412-
>>> squares[:]
413-
[1, 4, 9, 16, 25]
414-
415408
Lists also support operations like concatenation::
416409

417410
>>> squares + [36, 49, 64, 81, 100]
@@ -435,6 +428,30 @@ the :meth:`!list.append` *method* (we will see more about methods later)::
435428
>>> cubes
436429
[1, 8, 27, 64, 125, 216, 343]
437430

431+
Simple assignment in Python never copies data. When you assign a list
432+
to a variable, the variable refers to the *existing list*.
433+
Any changes you make to the list through one variable will be seen
434+
through all other variables that refer to it.::
435+
436+
>>> rgb = ["Red", "Green", "Blue"]
437+
>>> rgba = rgb
438+
>>> id(rgb) == id(rgba) # they reference the same object
439+
True
440+
>>> rgba.append("Alph")
441+
>>> rgb
442+
["Red", "Green", "Blue", "Alph"]
443+
444+
All slice operations return a new list containing the requested elements. This
445+
means that the following slice returns a
446+
:ref:`shallow copy <shallow_vs_deep_copy>` of the list::
447+
448+
>>> correct_rgba = rgba[:]
449+
>>> correct_rgba[-1] = "Alpha"
450+
>>> correct_rgba
451+
["Red", "Green", "Blue", "Alpha"]
452+
>>> rgba
453+
["Red", "Green", "Blue", "Alph"]
454+
438455
Assignment to slices is also possible, and this can even change the size of the
439456
list or clear it entirely::
440457

0 commit comments

Comments
 (0)