Skip to content

Commit 9bc76a1

Browse files
committed
Merge remote-tracking branch 'upstream/main' into gh-145866-call_intrinsic_2
2 parents 59d6fca + 6009309 commit 9bc76a1

File tree

132 files changed

+2843
-1423
lines changed

Some content is hidden

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

132 files changed

+2843
-1423
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,19 +427,19 @@ Lib/dataclasses.py @ericvsmith
427427
Lib/test/test_dataclasses/ @ericvsmith
428428

429429
# Dates and times
430-
Doc/**/*time.rst @pganssle @abalkin @StanFromIreland
430+
Doc/**/*time.rst @pganssle @StanFromIreland
431431
Doc/library/datetime-* @pganssle @StanFromIreland
432432
Doc/library/zoneinfo.rst @pganssle @StanFromIreland
433-
Include/datetime.h @pganssle @abalkin @StanFromIreland
434-
Include/internal/pycore_time.h @pganssle @abalkin @StanFromIreland
433+
Include/datetime.h @pganssle @StanFromIreland
434+
Include/internal/pycore_time.h @pganssle @StanFromIreland
435435
Lib/test/test_zoneinfo/ @pganssle @StanFromIreland
436436
Lib/zoneinfo/ @pganssle @StanFromIreland
437-
Lib/*time.py @pganssle @abalkin @StanFromIreland
438-
Lib/test/datetimetester.py @pganssle @abalkin @StanFromIreland
439-
Lib/test/test_*time.py @pganssle @abalkin @StanFromIreland
437+
Lib/*time.py @pganssle @StanFromIreland
438+
Lib/test/datetimetester.py @pganssle @StanFromIreland
439+
Lib/test/test_*time.py @pganssle @StanFromIreland
440440
Modules/*zoneinfo* @pganssle @StanFromIreland
441-
Modules/*time* @pganssle @abalkin @StanFromIreland
442-
Python/pytime.c @pganssle @abalkin @StanFromIreland
441+
Modules/*time* @pganssle @StanFromIreland
442+
Python/pytime.c @pganssle @StanFromIreland
443443

444444
# Dbm
445445
Doc/library/dbm.rst @corona10 @erlend-aasland @serhiy-storchaka

Doc/library/ast.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ Node classes
131131
Simple indices are represented by their value, extended slices are
132132
represented as tuples.
133133

134+
.. versionchanged:: 3.13
135+
136+
AST node constructors were changed to provide sensible defaults for omitted
137+
fields: optional fields now default to ``None``, list fields default to an
138+
empty list, and fields of type :class:`!ast.expr_context` default to
139+
:class:`Load() <ast.Load>`. Previously, omitted attributes would not exist on constructed
140+
nodes (accessing them raised :exc:`AttributeError`).
141+
134142
.. versionchanged:: 3.14
135143

136144
The :meth:`~object.__repr__` output of :class:`~ast.AST` nodes includes

Doc/library/math.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,8 @@ Constants
848848

849849
The :mod:`!math` module consists mostly of thin wrappers around the platform C
850850
math library functions. Behavior in exceptional cases follows Annex F of
851-
the C99 standard where appropriate. The current implementation will raise
851+
the C99 standard, if :attr:`sys.float_info.iec_60559` is true.
852+
The current implementation will raise
852853
:exc:`ValueError` for invalid operations like ``sqrt(-1.0)`` or ``log(0.0)``
853854
(where C99 Annex F recommends signaling invalid operation or divide-by-zero),
854855
and :exc:`OverflowError` for results that overflow (for example,

Doc/library/sys.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,15 +694,16 @@ always available. Unless explicitly noted otherwise, all variables are read-only
694694
A :term:`named tuple` holding information about the float type. It
695695
contains low level information about the precision and internal
696696
representation. The values correspond to the various floating-point
697-
constants defined in the standard header file :file:`float.h` for the 'C'
698-
programming language; see section 5.2.4.2.2 of the 1999 ISO/IEC C standard
699-
[C99]_, 'Characteristics of floating types', for details.
697+
constants defined by C implementation and in the standard header file
698+
:file:`float.h` for the 'C' programming language; see Annex F and section
699+
5.2.4.2.2 of the 1999 ISO/IEC C standard [C99]_, 'Characteristics of
700+
floating types', for details.
700701

701702
.. list-table:: Attributes of the :data:`!float_info` :term:`named tuple`
702703
:header-rows: 1
703704

704705
* - attribute
705-
- float.h macro
706+
- C macro
706707
- explanation
707708

708709
* - .. attribute:: float_info.epsilon
@@ -771,6 +772,12 @@ always available. Unless explicitly noted otherwise, all variables are read-only
771772
All other values for :c:macro:`!FLT_ROUNDS` characterize
772773
implementation-defined rounding behavior.
773774

775+
* - .. attribute:: float_info.iec_60559
776+
- :c:macro:`!__STDC_IEC_559__`
777+
- A boolean, indicating support the IEC 60559 floating-point standard.
778+
If true, the :class:`float` type characteristics and behavior matches
779+
the IEC 60559 double format.
780+
774781
The attribute :attr:`sys.float_info.dig` needs further explanation. If
775782
``s`` is any string representing a decimal number with at most
776783
:attr:`!sys.float_info.dig` significant digits, then converting ``s`` to a

Doc/using/cmdline.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,6 +1132,14 @@ conflict.
11321132
and kill the process. Only enable this in environments where the
11331133
huge-page pool is properly sized and fork-safety is not a concern.
11341134

1135+
On Windows you need a special privilege. See the
1136+
`Windows documentation for large pages
1137+
<https://learn.microsoft.com/windows/win32/memory/large-page-support>`_
1138+
for details. Python will fail on startup if the required privilege
1139+
`SeLockMemoryPrivilege
1140+
<https://learn.microsoft.com/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/lock-pages-in-memory>`_
1141+
is not held by the user.
1142+
11351143
.. versionadded:: 3.15
11361144

11371145

Doc/using/configure.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -795,9 +795,18 @@ also be used to improve performance.
795795

796796
Even when compiled with this option, huge pages are **not** used at runtime
797797
unless the :envvar:`PYTHON_PYMALLOC_HUGEPAGES` environment variable is set
798-
to ``1``. This opt-in is required because huge pages carry risks on Linux:
799-
if the huge-page pool is exhausted, page faults (including copy-on-write
800-
faults after :func:`os.fork`) deliver ``SIGBUS`` and kill the process.
798+
to ``1``. This opt-in is required because huge pages
799+
800+
* carry risks on Linux: if the huge-page pool is exhausted, page faults
801+
(including copy-on-write faults after :func:`os.fork`) deliver ``SIGBUS``
802+
and kill the process.
803+
804+
* need a special privilege on Windows. See the `Windows documentation for large pages
805+
<https://learn.microsoft.com/windows/win32/memory/large-page-support>`_
806+
for details. Python will fail on startup if the required privilege
807+
`SeLockMemoryPrivilege
808+
<https://learn.microsoft.com/previous-versions/windows/it-pro/windows-10/security/threat-protection/security-policy-settings/lock-pages-in-memory>`_
809+
is not held by the user.
801810

802811
The configure script checks that the platform supports ``MAP_HUGETLB``
803812
and emits a warning if it is not available.

Doc/whatsnew/3.15.rst

Lines changed: 85 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -690,26 +690,6 @@ collections
690690
(Contributed by Raymond Hettinger in :gh:`138682`.)
691691

692692

693-
collections.abc
694-
---------------
695-
696-
* :class:`collections.abc.ByteString` has been removed from
697-
``collections.abc.__all__``. :class:`!collections.abc.ByteString` has been
698-
deprecated since Python 3.12, and is scheduled for removal in Python 3.17.
699-
700-
* The following statements now cause ``DeprecationWarning``\ s to be emitted at
701-
runtime:
702-
703-
* ``from collections.abc import ByteString``
704-
* ``import collections.abc; collections.abc.ByteString``.
705-
706-
``DeprecationWarning``\ s were already emitted if
707-
:class:`collections.abc.ByteString` was subclassed or used as the second
708-
argument to :func:`isinstance` or :func:`issubclass`, but warnings were not
709-
previously emitted if it was merely imported or accessed from the
710-
:mod:`!collections.abc` module.
711-
712-
713693
concurrent.futures
714694
------------------
715695

@@ -836,13 +816,12 @@ mimetypes
836816

837817
* Add ``application/dicom`` MIME type for ``.dcm`` extension.
838818
(Contributed by Benedikt Johannes in :gh:`144217`.)
819+
* Add ``application/efi``. (Contributed by Charlie Lin in :gh:`145720`.)
839820
* Add ``application/node`` MIME type for ``.cjs`` extension.
840821
(Contributed by John Franey in :gh:`140937`.)
841822
* Add ``application/toml``. (Contributed by Gil Forcada in :gh:`139959`.)
842823
* Add ``application/sql`` and ``application/vnd.sqlite3``.
843824
(Contributed by Charlie Lin in :gh:`145698`.)
844-
* Add ``image/jxl``. (Contributed by Foolbar in :gh:`144213`.)
845-
* Add ``application/efi``. (Contributed by Charlie Lin in :gh:`145720`.)
846825
* Add the following MIME types:
847826

848827
- ``application/vnd.ms-cab-compressed`` for ``.cab`` extension
@@ -851,6 +830,7 @@ mimetypes
851830

852831
(Contributed by Charlie Lin in :gh:`145718`.)
853832

833+
* Add ``image/jxl``. (Contributed by Foolbar in :gh:`144213`.)
854834
* Rename ``application/x-texinfo`` to ``application/texinfo``.
855835
(Contributed by Charlie Lin in :gh:`140165`.)
856836
* Changed the MIME type for ``.ai`` files to ``application/pdf``.
@@ -960,7 +940,7 @@ ssl
960940
---
961941

962942
* Indicate through :data:`ssl.HAS_PSK_TLS13` whether the :mod:`ssl` module
963-
supports "External PSKs" in TLSv1.3, as described in RFC 9258.
943+
supports "External PSKs" in TLSv1.3, as described in :rfc:`9258`.
964944
(Contributed by Will Childs-Klein in :gh:`133624`.)
965945

966946
* Added new methods for managing groups used for SSL key agreement
@@ -1035,6 +1015,11 @@ sys
10351015
* Add :data:`sys.abi_info` namespace to improve access to ABI information.
10361016
(Contributed by Klaus Zimmermann in :gh:`137476`.)
10371017

1018+
* Add :data:`sys.float_info.iec_60559 <sys.float_info>`: a boolean flag,
1019+
indicating support the IEC 60559 floating-point standard (as specified by the
1020+
Annex F of C99).
1021+
(Contributed by Sergey B Kirpichev in :gh:`138580`.)
1022+
10381023

10391024
tarfile
10401025
-------
@@ -1146,14 +1131,48 @@ tomllib
11461131

11471132

11481133
types
1149-
------
1134+
-----
11501135

11511136
* Expose the write-through :func:`locals` proxy type
11521137
as :data:`types.FrameLocalsProxyType`.
11531138
This represents the type of the :attr:`frame.f_locals` attribute,
11541139
as described in :pep:`667`.
11551140

11561141

1142+
typing
1143+
------
1144+
1145+
.. _whatsnew315-typeform:
1146+
1147+
* :pep:`747`: Add :data:`~typing.TypeForm`, a new special form for annotating
1148+
values that are themselves type expressions.
1149+
``TypeForm[T]`` means "a type form object describing ``T`` (or a type
1150+
assignable to ``T``)". At runtime, ``TypeForm(x)`` simply returns ``x``,
1151+
which allows explicit annotation of type-form values without changing
1152+
behavior.
1153+
1154+
This helps libraries that accept user-provided type expressions
1155+
(for example ``int``, ``str | None``, :class:`~typing.TypedDict`
1156+
classes, or ``list[int]``) expose precise signatures:
1157+
1158+
.. code-block:: python
1159+
1160+
from typing import Any, TypeForm
1161+
1162+
def cast[T](typ: TypeForm[T], value: Any) -> T: ...
1163+
1164+
(Contributed by Jelle Zijlstra in :gh:`145033`.)
1165+
1166+
* Code like ``class ExtraTypeVars(P1[S], Protocol[T, T2]): ...`` now raises
1167+
a :exc:`TypeError`, because ``S`` is not listed in ``Protocol`` parameters.
1168+
(Contributed by Nikita Sobolev in :gh:`137191`.)
1169+
1170+
* Code like ``class B2(A[T2], Protocol[T1, T2]): ...`` now correctly handles
1171+
type parameters order: it is ``(T1, T2)``, not ``(T2, T1)``
1172+
as it was incorrectly inferred in runtime before.
1173+
(Contributed by Nikita Sobolev in :gh:`137191`.)
1174+
1175+
11571176
unicodedata
11581177
-----------
11591178

@@ -1390,6 +1409,14 @@ Diego Russo in :gh:`140683` and :gh:`142305`.)
13901409
Removed
13911410
========
13921411

1412+
collections.abc
1413+
---------------
1414+
1415+
* :class:`collections.abc.ByteString` has been removed from
1416+
``collections.abc.__all__``. :class:`!collections.abc.ByteString` has been
1417+
deprecated since Python 3.12, and is scheduled for removal in Python 3.17.
1418+
1419+
13931420
ctypes
13941421
------
13951422

@@ -1466,26 +1493,9 @@ threading
14661493
typing
14671494
------
14681495

1469-
.. _whatsnew315-typeform:
1470-
1471-
* :pep:`747`: Add :data:`~typing.TypeForm`, a new special form for annotating
1472-
values that are themselves type expressions.
1473-
``TypeForm[T]`` means "a type form object describing ``T`` (or a type
1474-
assignable to ``T``)". At runtime, ``TypeForm(x)`` simply returns ``x``,
1475-
which allows explicit annotation of type-form values without changing
1476-
behavior.
1477-
1478-
This helps libraries that accept user-provided type expressions
1479-
(for example ``int``, ``str | None``, :class:`~typing.TypedDict`
1480-
classes, or ``list[int]``) expose precise signatures:
1481-
1482-
.. code-block:: python
1483-
1484-
from typing import Any, TypeForm
1485-
1486-
def cast[T](typ: TypeForm[T], value: Any) -> T: ...
1487-
1488-
(Contributed by Jelle Zijlstra in :gh:`145033`.)
1496+
* :class:`typing.ByteString` has been removed from ``typing.__all__``.
1497+
:class:`!typing.ByteString` has been deprecated since Python 3.9, and is
1498+
scheduled for removal in Python 3.17.
14891499

14901500
* The undocumented keyword argument syntax for creating
14911501
:class:`~typing.NamedTuple` classes (for example,
@@ -1499,33 +1509,6 @@ typing
14991509
or ``TD = TypedDict("TD", {})`` instead.
15001510
(Contributed by Bénédikt Tran in :gh:`133823`.)
15011511

1502-
* Code like ``class ExtraTypeVars(P1[S], Protocol[T, T2]): ...`` now raises
1503-
a :exc:`TypeError`, because ``S`` is not listed in ``Protocol`` parameters.
1504-
(Contributed by Nikita Sobolev in :gh:`137191`.)
1505-
1506-
* Code like ``class B2(A[T2], Protocol[T1, T2]): ...`` now correctly handles
1507-
type parameters order: it is ``(T1, T2)``, not ``(T2, T1)``
1508-
as it was incorrectly inferred in runtime before.
1509-
(Contributed by Nikita Sobolev in :gh:`137191`.)
1510-
1511-
* :class:`typing.ByteString` has been removed from ``typing.__all__``.
1512-
:class:`!typing.ByteString` has been deprecated since Python 3.9, and is
1513-
scheduled for removal in Python 3.17.
1514-
1515-
* The following statements now cause ``DeprecationWarning``\ s to be emitted at
1516-
runtime:
1517-
1518-
* ``from typing import ByteString``
1519-
* ``import typing; typing.ByteString``.
1520-
1521-
``DeprecationWarning``\ s were already emitted if :class:`typing.ByteString`
1522-
was subclassed or used as the second argument to :func:`isinstance` or
1523-
:func:`issubclass`, but warnings were not previously emitted if it was merely
1524-
imported or accessed from the :mod:`!typing` module.
1525-
1526-
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
1527-
(Contributed by Nikita Sobolev in :gh:`133601`.)
1528-
15291512

15301513
wave
15311514
----
@@ -1584,6 +1567,21 @@ New deprecations
15841567

15851568
(Contributed by Nikita Sobolev in :gh:`136355`.)
15861569

1570+
* :mod:`collections.abc`
1571+
1572+
* The following statements now cause ``DeprecationWarning``\ s to be emitted
1573+
at runtime:
1574+
1575+
* ``from collections.abc import ByteString``
1576+
* ``import collections.abc; collections.abc.ByteString``.
1577+
1578+
``DeprecationWarning``\ s were already emitted if
1579+
:class:`collections.abc.ByteString` was subclassed or used as the second
1580+
argument to :func:`isinstance` or :func:`issubclass`, but warnings were not
1581+
previously emitted if it was merely imported or accessed from the
1582+
:mod:`!collections.abc` module.
1583+
1584+
15871585
* :mod:`hashlib`:
15881586

15891587
* In hash function constructors such as :func:`~hashlib.new` or the
@@ -1607,6 +1605,22 @@ New deprecations
16071605

16081606
(Contributed by Sergey B Kirpichev and Serhiy Storchaka in :gh:`143715`.)
16091607

1608+
* :mod:`typing`:
1609+
1610+
* The following statements now cause ``DeprecationWarning``\ s to be emitted
1611+
at runtime:
1612+
1613+
* ``from typing import ByteString``
1614+
* ``import typing; typing.ByteString``.
1615+
1616+
``DeprecationWarning``\ s were already emitted if :class:`typing.ByteString`
1617+
was subclassed or used as the second argument to :func:`isinstance` or
1618+
:func:`issubclass`, but warnings were not previously emitted if it was
1619+
merely imported or accessed from the :mod:`!typing` module.
1620+
1621+
* Deprecated :func:`!typing.no_type_check_decorator` has been removed.
1622+
(Contributed by Nikita Sobolev in :gh:`133601`.)
1623+
16101624
* ``__version__``
16111625

16121626
* The ``__version__``, ``version`` and ``VERSION`` attributes have been

Include/cpython/modsupport.h

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,7 @@ PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywordsFast(PyObject *, PyObject *,
3939
struct _PyArg_Parser *, ...);
4040

4141
#ifdef Py_BUILD_CORE
42-
// Internal; defined here to avoid explicitly including pycore_modsupport.h
43-
#define _Py_INTERNAL_ABI_SLOT \
44-
{Py_mod_abi, (void*) &(PyABIInfo) { \
45-
.abiinfo_major_version = 1, \
46-
.abiinfo_minor_version = 0, \
47-
.flags = PyABIInfo_INTERNAL, \
48-
.build_version = PY_VERSION_HEX, \
49-
.abi_version = PY_VERSION_HEX }} \
50-
///////////////////////////////////////////////////////
42+
// For internal use in stdlib. Needs C99 compound literals.
43+
// Defined here to avoid every stdlib module including pycore_modsupport.h
44+
#define _Py_ABI_SLOT {Py_mod_abi, (void*) &(PyABIInfo) _PyABIInfo_DEFAULT}
5145
#endif

0 commit comments

Comments
 (0)