Skip to content

Commit 8d4f21b

Browse files
generatedunixname1734921407115435facebook-github-bot
authored andcommitted
Import upstream CPython branch '3.14'
Summary: Python `3.14.0rc2+` (`3.14`) was **published** on 2025-09-09 16:15:40+00:00. # Commit Info Base: (`3.14.0rc2+`) - `9b398cb3aceca6bd5930a4d9ad4501f3142c0c6a` (commit date: 2025-09-08 07:17:14+00:00) Imported: (`3.14.0rc2+`) - `3.14` (commit date: 2025-09-09 16:15:40+00:00) # Files added ```javascript Misc/NEWS.d/next/Core_and_Builtins/2025-09-01-16-09-02.gh-issue-138318.t-WEN5.rst Misc/NEWS.d/next/Library/2025-08-30-10-58-15.gh-issue-138253.9Ehj-N.rst Misc/NEWS.d/next/Security/2025-06-18-13-34-55.gh-issue-135661.NZlpWf.rst ``` Reviewed By: itamaro Differential Revision: D82110807 fbshipit-source-id: 10cb45db108bf3397dc32c0953ca1a9ec0b6ca89
1 parent 92991ea commit 8d4f21b

55 files changed

Lines changed: 472 additions & 158 deletions

Some content is hidden

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

Android/android.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,12 +737,10 @@ def ci(context):
737737
# Prove the package is self-contained by using it to run the tests.
738738
shutil.unpack_archive(package_path, temp_dir)
739739

740-
# Arguments are similar to --fast-ci, but in single-process mode.
740+
# Randomization is disabled because order-dependent failures are
741+
# much less likely to pass on a rerun in single-process mode.
741742
launcher_args = ["--managed", "maxVersion", "-v"]
742-
test_args = [
743-
"--single-process", "--fail-env-changed", "--rerun", "--slowest",
744-
"--verbose3", "-u", "all,-cpu", "--timeout=600"
745-
]
743+
test_args = ["--fast-ci", "--single-process", "--no-randomize"]
746744
run(
747745
["./android.py", "test", *launcher_args, "--", *test_args],
748746
cwd=temp_dir

Doc/conf.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,6 @@
221221
('envvar', 'USER'),
222222
('envvar', 'USERNAME'),
223223
('envvar', 'USERPROFILE'),
224-
# Deprecated function that was never documented:
225-
('py:func', 'getargspec'),
226-
('py:func', 'inspect.getargspec'),
227-
# Undocumented modules that users shouldn't have to worry about
228-
# (implementation details of `os.path`):
229-
('py:mod', 'ntpath'),
230-
('py:mod', 'posixpath'),
231224
]
232225

233226
# Temporary undocumented names.
@@ -242,8 +235,6 @@
242235
('py:meth', '_SubParsersAction.add_parser'),
243236
# Attributes/methods/etc. that definitely should be documented better,
244237
# but are deferred for now:
245-
('py:attr', '__annotations__'),
246-
('py:meth', '__missing__'),
247238
('py:attr', '__wrapped__'),
248239
]
249240

Doc/howto/descriptor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Here are three practical data validation utilities:
420420

421421
def validate(self, value):
422422
if not isinstance(value, str):
423-
raise TypeError(f'Expected {value!r} to be an str')
423+
raise TypeError(f'Expected {value!r} to be a str')
424424
if self.minsize is not None and len(value) < self.minsize:
425425
raise ValueError(
426426
f'Expected {value!r} to be no smaller than {self.minsize!r}'

Doc/library/annotationlib.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ and :func:`call_annotate_function`, as well as the
4646
:func:`call_evaluate_function` function for working with
4747
:term:`evaluate functions <evaluate function>`.
4848

49+
.. caution::
50+
51+
Most functionality in this module can execute arbitrary code; see
52+
:ref:`the security section <annotationlib-security>` for more information.
4953

5054
.. seealso::
5155

@@ -604,3 +608,23 @@ Below are a few examples of the behavior with unsupported expressions:
604608
>>> def ifexp(x: 1 if y else 0): ...
605609
>>> get_annotations(ifexp, format=Format.STRING)
606610
{'x': '1'}
611+
612+
.. _annotationlib-security:
613+
614+
Security implications of introspecting annotations
615+
--------------------------------------------------
616+
617+
Much of the functionality in this module involves executing code related to annotations,
618+
which can then do arbitrary things. For example,
619+
:func:`get_annotations` may call an arbitrary :term:`annotate function`, and
620+
:meth:`ForwardRef.evaluate` may call :func:`eval` on an arbitrary string. Code contained
621+
in an annotation might make arbitrary system calls, enter an infinite loop, or perform any
622+
other operation. This is also true for any access of the :attr:`~object.__annotations__` attribute,
623+
and for various functions in the :mod:`typing` module that work with annotations, such as
624+
:func:`typing.get_type_hints`.
625+
626+
Any security issue arising from this also applies immediately after importing
627+
code that may contain untrusted annotations: importing code can always cause arbitrary operations
628+
to be performed. However, it is unsafe to accept strings or other input from an untrusted source and
629+
pass them to any of the APIs for introspecting annotations, for example by editing an
630+
``__annotations__`` dictionary or directly creating a :class:`ForwardRef` object.

Doc/library/collections.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -758,9 +758,9 @@ stack manipulations such as ``dup``, ``drop``, ``swap``, ``over``, ``pick``,
758758

759759
.. attribute:: default_factory
760760

761-
This attribute is used by the :meth:`__missing__` method; it is
762-
initialized from the first argument to the constructor, if present, or to
763-
``None``, if absent.
761+
This attribute is used by the :meth:`~defaultdict.__missing__` method;
762+
it is initialized from the first argument to the constructor, if present,
763+
or to ``None``, if absent.
764764

765765
.. versionchanged:: 3.9
766766
Added merge (``|``) and update (``|=``) operators, specified in

Doc/library/dataclasses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ Module contents
439439
function is used.
440440

441441
This function is not strictly required, because any Python
442-
mechanism for creating a new class with :attr:`!__annotations__` can
442+
mechanism for creating a new class with :attr:`~object.__annotations__` can
443443
then apply the :func:`@dataclass <dataclass>` function to convert that class to
444444
a dataclass. This function is provided as a convenience. For
445445
example::

Doc/library/dis.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,11 @@ iterations of the loop.
10861086
Pushes ``co_consts[consti]`` onto the stack.
10871087

10881088

1089+
.. opcode:: LOAD_CONST_IMMORTAL (consti)
1090+
1091+
Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects.
1092+
1093+
10891094
.. opcode:: LOAD_SMALL_INT (i)
10901095

10911096
Pushes the integer ``i`` onto the stack.

Doc/library/functions.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,13 +1559,19 @@ are always available. They are listed here in alphabetical order.
15591559
.. versionchanged:: 3.11
15601560
The ``'U'`` mode has been removed.
15611561

1562-
.. function:: ord(c)
1562+
.. function:: ord(character, /)
15631563

1564-
Given a string representing one Unicode character, return an integer
1565-
representing the Unicode code point of that character. For example,
1564+
Return the ordinal value of a character.
1565+
1566+
If the argument is a one-character string, return the Unicode code point
1567+
of that character. For example,
15661568
``ord('a')`` returns the integer ``97`` and ``ord('€')`` (Euro sign)
15671569
returns ``8364``. This is the inverse of :func:`chr`.
15681570

1571+
If the argument is a :class:`bytes` or :class:`bytearray` object of
1572+
length 1, return its single byte value.
1573+
For example, ``ord(b'a')`` returns the integer ``97``.
1574+
15691575

15701576
.. function:: pow(base, exp, mod=None)
15711577

Doc/library/getpass.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ The :mod:`getpass` module provides two functions:
3939
If you call getpass from within IDLE, the input may be done in the
4040
terminal you launched IDLE from rather than the idle window itself.
4141

42+
.. note::
43+
On Unix systems, when *echo_char* is set, the terminal will be
44+
configured to operate in
45+
:manpage:`noncanonical mode <termios(3)#Canonical_and_noncanonical_mode>`.
46+
In particular, this means that line editing shortcuts such as
47+
:kbd:`Ctrl+U` will not work and may insert unexpected characters into
48+
the input.
49+
4250
.. versionchanged:: 3.14
4351
Added the *echo_char* parameter for keyboard feedback.
4452

Doc/library/inspect.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ Classes and functions
11791179
:func:`signature` in Python 3.5, but that decision has been reversed
11801180
in order to restore a clearly supported standard interface for
11811181
single-source Python 2/3 code migrating away from the legacy
1182-
:func:`getargspec` API.
1182+
:func:`!getargspec` API.
11831183

11841184
.. versionchanged:: 3.7
11851185
Python only explicitly guaranteed that it preserved the declaration
@@ -1289,6 +1289,11 @@ Classes and functions
12891289
This is an alias for :func:`annotationlib.get_annotations`; see the documentation
12901290
of that function for more information.
12911291

1292+
.. caution::
1293+
1294+
This function may execute arbitrary code contained in annotations.
1295+
See :ref:`annotationlib-security` for more information.
1296+
12921297
.. versionadded:: 3.10
12931298

12941299
.. versionchanged:: 3.14

0 commit comments

Comments
 (0)