Skip to content

Commit 1cf88a6

Browse files
itamarofacebook-github-bot
authored andcommitted
Sync upstream CPython branch '3.14'
Summary: Python `3.14.0rc3+` (`3.14`) was **published** on 2025-09-18 17:54:43+00:00. # Commit Info Base: (`3.14.0rc2+`) - `1c901860e621615ecf9b77400d6cfae2c975d93a` (commit date: 2025-09-16 09:10:53+00:00) Imported: (`3.14.0rc3+`) - `a20395b899163b4d337107b2c4ca1f3cef467462` (commit date: 2025-09-18 17:54:43+00:00) # Files added ``` Lib/test/test_pyrepl/eio_test_script.py Misc/NEWS.d/3.14.0rc3.rst Python/emscripten_trampoline_inner.c Tools/wasm/emscripten/prepare_external_wasm.py ``` # Files removed ``` Misc/NEWS.d/next/Core_and_Builtins/2025-08-10-21-34-12.gh-issue-137576.0ZicS-.rst Misc/NEWS.d/next/Core_and_Builtins/2025-08-14-14-18-29.gh-issue-137728.HdYS9R.rst Misc/NEWS.d/next/Core_and_Builtins/2025-08-15-15-45-26.gh-issue-137079.YEow69.rst Misc/NEWS.d/next/Core_and_Builtins/2025-08-17-13-36-53.gh-issue-137883.55VDCN.rst Misc/NEWS.d/next/Core_and_Builtins/2025-08-22-11-39-40.gh-issue-137384.j4b_in.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-13-54-43.gh-issue-138349.0fGmAi.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-02-09-10-06.gh-issue-138372.h1Xk4-.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-03-17-00-30.gh-issue-138479.qUxgWs.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-05-01-19-04.gh-issue-138192.erluq5.rst Misc/NEWS.d/next/Core_and_Builtins/2025-09-10-14-53-59.gh-issue-71810.ppf0J-.rst Misc/NEWS.d/next/Library/2025-06-01-11-14-00.gh-issue-134953.ashdfs.rst Misc/NEWS.d/next/Library/2025-07-13-11-20-05.gh-issue-136134.xhh0Kq.rst Misc/NEWS.d/next/Library/2025-07-13-13-31-22.gh-issue-136134.mh6VjS.rst Misc/NEWS.d/next/Library/2025-08-16-18-11-41.gh-issue-90548.q3aJUK.rst Misc/NEWS.d/next/Library/2025-08-18-16-02-51.gh-issue-134869.GnAjnU.rst Misc/NEWS.d/next/Library/2025-08-30-10-58-15.gh-issue-138253.9Ehj-N.rst Misc/NEWS.d/next/Library/2025-09-05-07-50-18.gh-issue-138515.E3M-pu.rst Misc/NEWS.d/next/Library/2025-09-10-10-02-59.gh-issue-128636.ldRKGZ.rst Misc/NEWS.d/next/Library/2025-09-12-01-01-05.gh-issue-138804.46ZukT.rst Misc/NEWS.d/next/Security/2025-06-18-13-34-55.gh-issue-135661.NZlpWf.rst Misc/NEWS.d/next/Tools-Demos/2025-08-21-14-04-50.gh-issue-137873.qxffLt.rst ``` Reviewed By: aleivag Differential Revision: D82725277 fbshipit-source-id: 4b6bc890befa113050def917514eb3651bafae31
1 parent 2b43423 commit 1cf88a6

79 files changed

Lines changed: 2317 additions & 1148 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.

Doc/deprecations/c-api-pending-removal-in-3.18.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
Pending removal in Python 3.18
22
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
33

4-
* Deprecated private functions (:gh:`128863`):
4+
* The following private functions are deprecated
5+
and planned for removal in Python 3.18:
56

67
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
78
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
8-
* :c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`.
9+
* :c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`.
910
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
1011
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
1112
use :c:func:`PyLongWriter_Create`.
@@ -31,7 +32,7 @@ Pending removal in Python 3.18
3132
:c:func:`PyUnicodeWriter_WriteSubstring(writer, str, start, end) <PyUnicodeWriter_WriteSubstring>`.
3233
* :c:func:`!_PyUnicodeWriter_WriteASCIIString`:
3334
replace ``_PyUnicodeWriter_WriteASCIIString(&writer, str)`` with
34-
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
35+
:c:func:`PyUnicodeWriter_WriteASCII(writer, str) <PyUnicodeWriter_WriteASCII>`.
3536
* :c:func:`!_PyUnicodeWriter_WriteLatin1String`:
3637
replace ``_PyUnicodeWriter_WriteLatin1String(&writer, str)`` with
3738
:c:func:`PyUnicodeWriter_WriteUTF8(writer, str) <PyUnicodeWriter_WriteUTF8>`.
@@ -41,5 +42,6 @@ Pending removal in Python 3.18
4142
* :c:func:`!_Py_fopen_obj`: use :c:func:`Py_fopen`.
4243

4344
The `pythoncapi-compat project
44-
<https://github.com/python/pythoncapi-compat/>`__ can be used to get these
45-
new public functions on Python 3.13 and older.
45+
<https://github.com/python/pythoncapi-compat/>`__ can be used to get
46+
these new public functions on Python 3.13 and older.
47+
(Contributed by Victor Stinner in :gh:`128863`.)

Doc/deprecations/pending-removal-in-3.14.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ Pending removal in Python 3.14
3838
is no current event loop set and it decides to create one.
3939
(Contributed by Serhiy Storchaka and Guido van Rossum in :gh:`100160`.)
4040

41-
* :mod:`collections.abc`: Deprecated :class:`!collections.abc.ByteString`.
42-
Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`.
43-
For use in typing, prefer a union, like ``bytes | bytearray``,
44-
or :class:`collections.abc.Buffer`.
45-
(Contributed by Shantanu Jain in :gh:`91896`.)
46-
4741
* :mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils.localtime`.
4842
(Contributed by Alan Williams in :gh:`72346`.)
4943

@@ -96,9 +90,6 @@ Pending removal in Python 3.14
9690
if :ref:`named placeholders <sqlite3-placeholders>` are used and
9791
*parameters* is a sequence instead of a :class:`dict`.
9892

99-
* :mod:`typing`: :class:`!typing.ByteString`, deprecated since Python 3.9,
100-
now causes a :exc:`DeprecationWarning` to be emitted when it is used.
101-
10293
* :mod:`urllib`:
10394
:class:`!urllib.parse.Quoter` is deprecated: it was not intended to be a
10495
public API.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,51 @@
11
Pending removal in Python 3.17
22
------------------------------
33

4+
* :mod:`collections.abc`:
5+
6+
- :class:`collections.abc.ByteString` is scheduled for removal in Python 3.17.
7+
8+
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
9+
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use
10+
in type annotations, either use :class:`~collections.abc.Buffer` or a union
11+
that explicitly specifies the types your code supports (e.g.,
12+
``bytes | bytearray | memoryview``).
13+
14+
:class:`!ByteString` was originally intended to be an abstract class that
15+
would serve as a supertype of both :class:`bytes` and :class:`bytearray`.
16+
However, since the ABC never had any methods, knowing that an object was an
17+
instance of :class:`!ByteString` never actually told you anything useful
18+
about the object. Other common buffer types such as :class:`memoryview`
19+
were also never understood as subtypes of :class:`!ByteString` (either at
20+
runtime or by static type checkers).
21+
22+
See :pep:`PEP 688 <688#current-options>` for more details.
23+
(Contributed by Shantanu Jain in :gh:`91896`.)
24+
25+
426
* :mod:`typing`:
527

628
- Before Python 3.14, old-style unions were implemented using the private class
729
``typing._UnionGenericAlias``. This class is no longer needed for the implementation,
830
but it has been retained for backward compatibility, with removal scheduled for Python
931
3.17. Users should use documented introspection helpers like :func:`typing.get_origin`
1032
and :func:`typing.get_args` instead of relying on private implementation details.
33+
- :class:`typing.ByteString`, deprecated since Python 3.9, is scheduled for removal in
34+
Python 3.17.
35+
36+
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
37+
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use
38+
in type annotations, either use :class:`~collections.abc.Buffer` or a union
39+
that explicitly specifies the types your code supports (e.g.,
40+
``bytes | bytearray | memoryview``).
41+
42+
:class:`!ByteString` was originally intended to be an abstract class that
43+
would serve as a supertype of both :class:`bytes` and :class:`bytearray`.
44+
However, since the ABC never had any methods, knowing that an object was an
45+
instance of :class:`!ByteString` never actually told you anything useful
46+
about the object. Other common buffer types such as :class:`memoryview`
47+
were also never understood as subtypes of :class:`!ByteString` (either at
48+
runtime or by static type checkers).
49+
50+
See :pep:`PEP 688 <688#current-options>` for more details.
51+
(Contributed by Shantanu Jain in :gh:`91896`.)

Doc/library/argparse.rst

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -774,16 +774,16 @@ how the command-line arguments should be handled. The supplied actions are:
774774
>>> parser.parse_args('--foo --bar'.split())
775775
Namespace(foo=True, bar=False, baz=True)
776776

777-
* ``'append'`` - This stores a list, and appends each argument value to the
778-
list. It is useful to allow an option to be specified multiple times.
779-
If the default value is non-empty, the default elements will be present
780-
in the parsed value for the option, with any values from the
781-
command line appended after those default values. Example usage::
777+
* ``'append'`` - This appends each argument value to a list.
778+
It is useful for allowing an option to be specified multiple times.
779+
If the default value is a non-empty list, the parsed value will start
780+
with the default list's elements and any values from the command line
781+
will be appended after those default values. Example usage::
782782

783783
>>> parser = argparse.ArgumentParser()
784-
>>> parser.add_argument('--foo', action='append')
784+
>>> parser.add_argument('--foo', action='append', default=['0'])
785785
>>> parser.parse_args('--foo 1 --foo 2'.split())
786-
Namespace(foo=['1', '2'])
786+
Namespace(foo=['0', '1', '2'])
787787

788788
* ``'append_const'`` - This stores a list, and appends the value specified by
789789
the const_ keyword argument to the list; note that the const_ keyword
@@ -981,8 +981,8 @@ the various :class:`ArgumentParser` actions. The two most common uses of it are
981981
(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional
982982
argument that can be followed by zero or one command-line arguments.
983983
When parsing the command line, if the option string is encountered with no
984-
command-line argument following it, the value of ``const`` will be assumed to
985-
be ``None`` instead. See the nargs_ description for examples.
984+
command-line argument following it, the value from ``const`` will be used.
985+
See the nargs_ description for examples.
986986

987987
.. versionchanged:: 3.11
988988
``const=None`` by default, including when ``action='append_const'`` or
@@ -1142,16 +1142,21 @@ if the argument was not one of the acceptable values::
11421142
game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',
11431143
'paper', 'scissors')
11441144

1145-
Note that inclusion in the *choices* sequence is checked after any type_
1146-
conversions have been performed, so the type of the objects in the *choices*
1147-
sequence should match the type_ specified.
1148-
11491145
Any sequence can be passed as the *choices* value, so :class:`list` objects,
11501146
:class:`tuple` objects, and custom sequences are all supported.
11511147

11521148
Use of :class:`enum.Enum` is not recommended because it is difficult to
11531149
control its appearance in usage, help, and error messages.
11541150

1151+
Note that *choices* are checked after any type_
1152+
conversions have been performed, so objects in *choices*
1153+
should match the type_ specified. This can make *choices*
1154+
appear unfamiliar in usage, help, or error messages.
1155+
1156+
To keep *choices* user-friendly, consider a custom type wrapper that
1157+
converts and formats values, or omit type_ and handle conversion in
1158+
your application code.
1159+
11551160
Formatted choices override the default *metavar* which is normally derived
11561161
from *dest*. This is usually what you want because the user never sees the
11571162
*dest* parameter. If this display isn't desirable (perhaps because there are

Doc/library/collections.abc.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ ABC Inherits from Abstract Methods Mi
140140
``__len__``,
141141
``insert``
142142

143+
:class:`ByteString` :class:`Sequence` ``__getitem__``, Inherited :class:`Sequence` methods
144+
``__len__``
145+
143146
:class:`Set` :class:`Collection` ``__contains__``, ``__le__``, ``__lt__``, ``__eq__``, ``__ne__``,
144147
``__iter__``, ``__gt__``, ``__ge__``, ``__and__``, ``__or__``,
145148
``__len__`` ``__sub__``, ``__rsub__``, ``__xor__``, ``__rxor__``
@@ -260,6 +263,7 @@ Collections Abstract Base Classes -- Detailed Descriptions
260263

261264
.. class:: Sequence
262265
MutableSequence
266+
ByteString
263267

264268
ABCs for read-only and mutable :term:`sequences <sequence>`.
265269

@@ -285,6 +289,25 @@ Collections Abstract Base Classes -- Detailed Descriptions
285289
The :meth:`~sequence.index` method gained support for
286290
the *stop* and *start* arguments.
287291

292+
.. deprecated-removed:: 3.12 3.17
293+
The :class:`ByteString` ABC has been deprecated.
294+
295+
Use ``isinstance(obj, collections.abc.Buffer)`` to test if ``obj``
296+
implements the :ref:`buffer protocol <bufferobjects>` at runtime. For use
297+
in type annotations, either use :class:`Buffer` or a union that
298+
explicitly specifies the types your code supports (e.g.,
299+
``bytes | bytearray | memoryview``).
300+
301+
:class:`!ByteString` was originally intended to be an abstract class that
302+
would serve as a supertype of both :class:`bytes` and :class:`bytearray`.
303+
However, since the ABC never had any methods, knowing that an object was
304+
an instance of :class:`!ByteString` never actually told you anything
305+
useful about the object. Other common buffer types such as
306+
:class:`memoryview` were also never understood as subtypes of
307+
:class:`!ByteString` (either at runtime or by static type checkers).
308+
309+
See :pep:`PEP 688 <688#current-options>` for more details.
310+
288311
.. class:: Set
289312
MutableSet
290313

Doc/library/getpass.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ The :mod:`getpass` module provides two functions:
2727

2828
The *echo_char* argument controls how user input is displayed while typing.
2929
If *echo_char* is ``None`` (default), input remains hidden. Otherwise,
30-
*echo_char* must be a printable ASCII string and each typed character
31-
is replaced by it. For example, ``echo_char='*'`` will display
32-
asterisks instead of the actual input.
30+
*echo_char* must be a single printable ASCII character and each
31+
typed character is replaced by it. For example, ``echo_char='*'`` will
32+
display asterisks instead of the actual input.
3333

3434
If echo free input is unavailable getpass() falls back to printing
3535
a warning message to *stream* and reading from ``sys.stdin`` and

Doc/library/html.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ This module defines utilities to manipulate HTML.
1414

1515
Convert the characters ``&``, ``<`` and ``>`` in string *s* to HTML-safe
1616
sequences. Use this if you need to display text that might contain such
17-
characters in HTML. If the optional flag *quote* is true, the characters
18-
(``"``) and (``'``) are also translated; this helps for inclusion in an HTML
19-
attribute value delimited by quotes, as in ``<a href="...">``.
17+
characters in HTML. If the optional flag *quote* is true (the default), the
18+
characters (``"``) and (``'``) are also translated; this helps for inclusion
19+
in an HTML attribute value delimited by quotes, as in ``<a href="...">``.
20+
If *quote* is set to false, the characters (``"``) and (``'``) are not
21+
translated.
22+
2023

2124
.. versionadded:: 3.2
2225

Doc/library/imaplib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ An :class:`IMAP4` instance has the following methods:
413413
the password. Will only work if the server ``CAPABILITY`` response includes the
414414
phrase ``AUTH=CRAM-MD5``.
415415

416-
.. versionchanged:: next
416+
.. versionchanged:: 3.14
417417
An :exc:`IMAP4.error` is raised if MD5 support is not available.
418418

419419

Doc/library/inspect.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
253253
+-----------------+-------------------+---------------------------+
254254
| | gi_running | is the generator running? |
255255
+-----------------+-------------------+---------------------------+
256+
| | gi_suspended | is the generator |
257+
| | | suspended? |
258+
+-----------------+-------------------+---------------------------+
256259
| | gi_code | code |
257260
+-----------------+-------------------+---------------------------+
258261
| | gi_yieldfrom | object being iterated by |

Doc/library/logging.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,15 @@ Formatter Objects
671671
which is just the logged message.
672672
:type fmt: str
673673

674-
:param datefmt: A format string in the given *style* for
675-
the date/time portion of the logged output.
674+
:param datefmt: A format string for the date/time portion of the logged output.
676675
If not specified, the default described in :meth:`formatTime` is used.
677676
:type datefmt: str
678677

679678
:param style: Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines
680679
how the format string will be merged with its data: using one of
681680
:ref:`old-string-formatting` (``%``), :meth:`str.format` (``{``)
682681
or :class:`string.Template` (``$``). This only applies to
683-
*fmt* and *datefmt* (e.g. ``'%(message)s'`` versus ``'{message}'``),
682+
*fmt* (e.g. ``'%(message)s'`` versus ``'{message}'``),
684683
not to the actual log messages passed to the logging methods.
685684
However, there are :ref:`other ways <formatting-styles>`
686685
to use ``{``- and ``$``-formatting for log messages.

0 commit comments

Comments
 (0)