Skip to content

Commit 56fe753

Browse files
committed
Merge branch 'main' into nedbat/improve-docs-page
2 parents 5a595b6 + e779777 commit 56fe753

File tree

95 files changed

+1652
-541
lines changed

Some content is hidden

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

95 files changed

+1652
-541
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ Python/jit.c @brandtbucher @savannahostrowski @diegorusso
292292
Tools/jit/ @brandtbucher @savannahostrowski @diegorusso
293293
InternalDocs/jit.md @brandtbucher @savannahostrowski @diegorusso @AA-Turner
294294

295+
# Lazy imports (PEP 810)
296+
Objects/lazyimportobject.c @twouters @DinoV @pablogsal
297+
Include/internal/pycore_lazyimportobject.h @twouters @DinoV @pablogsal
298+
Lib/test/test_import/test_lazy_imports.py @twouters @DinoV @pablogsal
299+
Lib/test/test_import/data/lazy_imports/ @twouters @DinoV @pablogsal
300+
295301
# Micro-op / μop / Tier 2 Optimiser
296302
Python/optimizer.c @markshannon @Fidget-Spinner
297303
Python/optimizer_analysis.c @markshannon @tomasr8 @Fidget-Spinner @savannahostrowski

.github/workflows/build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,18 @@ jobs:
242242
# BOLT currently crashes during instrumentation on aarch64
243243
- os: ubuntu-24.04-arm
244244
bolt: true
245+
include:
246+
# Enable CPU-intensive tests on ARM (default build only)
247+
- os: ubuntu-24.04-arm
248+
bolt: false
249+
free-threading: false
250+
test-opts: '-u cpu'
245251
uses: ./.github/workflows/reusable-ubuntu.yml
246252
with:
247253
bolt-optimizations: ${{ matrix.bolt }}
248254
free-threading: ${{ matrix.free-threading }}
249255
os: ${{ matrix.os }}
256+
test-opts: ${{ matrix.test-opts || '' }}
250257

251258
build-ubuntu-ssltests-openssl:
252259
name: 'Ubuntu SSL tests with OpenSSL'
@@ -261,7 +268,7 @@ jobs:
261268
# Keep 1.1.1w in our list despite it being upstream EOL and otherwise
262269
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
263270
# supported by important vendors such as AWS-LC.
264-
openssl_ver: [1.1.1w, 3.0.18, 3.3.5, 3.4.3, 3.5.4, 3.6.0]
271+
openssl_ver: [1.1.1w, 3.0.19, 3.3.6, 3.4.4, 3.5.5, 3.6.1]
265272
# See Tools/ssl/make_ssl_data.py for notes on adding a new version
266273
env:
267274
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -428,7 +435,7 @@ jobs:
428435
needs: build-context
429436
if: needs.build-context.outputs.run-ubuntu == 'true'
430437
env:
431-
OPENSSL_VER: 3.0.18
438+
OPENSSL_VER: 3.5.5
432439
PYTHONSTRICTEXTENSIONBUILD: 1
433440
steps:
434441
- uses: actions/checkout@v6
@@ -539,7 +546,7 @@ jobs:
539546
matrix:
540547
os: [ubuntu-24.04]
541548
env:
542-
OPENSSL_VER: 3.0.18
549+
OPENSSL_VER: 3.5.5
543550
PYTHONSTRICTEXTENSIONBUILD: 1
544551
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
545552
steps:
@@ -574,7 +581,7 @@ jobs:
574581
run: |
575582
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
576583
- name: Configure CPython
577-
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc
584+
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc --with-openssl="$OPENSSL_DIR"
578585
- name: Build CPython
579586
run: make -j4
580587
- name: Display build info

.github/workflows/reusable-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
3636
- name: Install Homebrew dependencies
3737
run: |
38-
brew install pkg-config openssl@3.0 xz gdbm tcl-tk@9 make
38+
brew install pkg-config openssl@3.5 xz gdbm tcl-tk@9 make
3939
# Because alternate versions are not symlinked into place by default:
4040
brew link --overwrite tcl-tk@9
4141
- name: Configure CPython
@@ -50,7 +50,7 @@ jobs:
5050
--enable-safety \
5151
${{ inputs.free-threading && '--disable-gil' || '' }} \
5252
--prefix=/opt/python-dev \
53-
--with-openssl="$(brew --prefix openssl@3.0)"
53+
--with-openssl="$(brew --prefix openssl@3.5)"
5454
- name: Build CPython
5555
if : ${{ inputs.free-threading || inputs.os != 'macos-15-intel' }}
5656
run: gmake -j8

.github/workflows/reusable-ubuntu.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
description: OS to run the job
1818
required: true
1919
type: string
20+
test-opts:
21+
description: Extra options to pass to the test runner via TESTOPTS
22+
required: false
23+
type: string
24+
default: ''
2025

2126
env:
2227
FORCE_COLOR: 1
@@ -27,7 +32,7 @@ jobs:
2732
runs-on: ${{ inputs.os }}
2833
timeout-minutes: 60
2934
env:
30-
OPENSSL_VER: 3.0.18
35+
OPENSSL_VER: 3.5.5
3136
PYTHONSTRICTEXTENSIONBUILD: 1
3237
TERM: linux
3338
steps:
@@ -111,4 +116,6 @@ jobs:
111116
run: sudo mount "$CPYTHON_RO_SRCDIR" -oremount,rw
112117
- name: Tests
113118
working-directory: ${{ env.CPYTHON_BUILDDIR }}
114-
run: xvfb-run make ci
119+
run: xvfb-run make ci EXTRATESTOPTS="${TEST_OPTS}"
120+
env:
121+
TEST_OPTS: ${{ inputs.test-opts }}

Android/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def make_build_python(context):
208208
def unpack_deps(host, prefix_dir):
209209
os.chdir(prefix_dir)
210210
deps_url = "https://github.com/beeware/cpython-android-source-deps/releases/download"
211-
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.18-0",
211+
for name_ver in ["bzip2-1.0.8-3", "libffi-3.4.4-3", "openssl-3.0.19-1",
212212
"sqlite-3.50.4-0", "xz-5.4.6-1", "zstd-1.5.7-1"]:
213213
filename = f"{name_ver}-{host}.tar.gz"
214214
download(f"{deps_url}/{name_ver}/{filename}")

Apple/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def unpack_deps(
316316
for name_ver in [
317317
"BZip2-1.0.8-2",
318318
"libFFI-3.4.7-2",
319-
"OpenSSL-3.0.18-1",
319+
"OpenSSL-3.0.19-1",
320320
"XZ-5.6.4-2",
321321
"mpdecimal-4.0.0-2",
322322
"zstd-1.5.7-1",

Doc/c-api/datetime.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ macros.
3030

3131
This is not compatible with subinterpreters.
3232

33+
.. versionchanged:: 3.15
34+
35+
This macro is now thread safe.
36+
3337
.. c:type:: PyDateTime_CAPI
3438
3539
Structure containing the fields for the datetime C API.
@@ -44,6 +48,11 @@ macros.
4448

4549
This variable is only available once :c:macro:`PyDateTime_IMPORT` succeeds.
4650

51+
.. versionchanged:: 3.15
52+
53+
This variable should not be accessed directly as direct access is not thread-safe.
54+
Use :c:func:`PyDateTime_IMPORT` instead.
55+
4756
.. c:type:: PyDateTime_Date
4857
4958
This subtype of :c:type:`PyObject` represents a Python date object.

Doc/c-api/dict.rst

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
.. _dictobjects:
44

5-
Dictionary Objects
5+
Dictionary objects
66
------------------
77

88
.. index:: pair: object; dictionary
@@ -444,7 +444,7 @@ Dictionary Objects
444444
.. versionadded:: 3.12
445445
446446
447-
Dictionary View Objects
447+
Dictionary view objects
448448
^^^^^^^^^^^^^^^^^^^^^^^
449449
450450
.. c:function:: int PyDictViewSet_Check(PyObject *op)
@@ -490,7 +490,58 @@ Dictionary View Objects
490490
always succeeds.
491491
492492
493-
Ordered Dictionaries
493+
Frozen dictionary objects
494+
^^^^^^^^^^^^^^^^^^^^^^^^^
495+
496+
.. versionadded:: next
497+
498+
499+
.. c:var:: PyTypeObject PyFrozenDict_Type
500+
501+
This instance of :c:type:`PyTypeObject` represents the Python frozen
502+
dictionary type.
503+
This is the same object as :class:`frozendict` in the Python layer.
504+
505+
506+
.. c:function:: int PyAnyDict_Check(PyObject *p)
507+
508+
Return true if *p* is a :class:`dict` object, a :class:`frozendict` object,
509+
or an instance of a subtype of the :class:`!dict` or :class:`!frozendict`
510+
type.
511+
This function always succeeds.
512+
513+
514+
.. c:function:: int PyAnyDict_CheckExact(PyObject *p)
515+
516+
Return true if *p* is a :class:`dict` object or a :class:`frozendict` object,
517+
but not an instance of a subtype of the :class:`!dict` or
518+
:class:`!frozendict` type.
519+
This function always succeeds.
520+
521+
522+
.. c:function:: int PyFrozenDict_Check(PyObject *p)
523+
524+
Return true if *p* is a :class:`frozendict` object or an instance of a
525+
subtype of the :class:`!frozendict` type.
526+
This function always succeeds.
527+
528+
529+
.. c:function:: int PyFrozenDict_CheckExact(PyObject *p)
530+
531+
Return true if *p* is a :class:`frozendict` object, but not an instance of a
532+
subtype of the :class:`!frozendict` type.
533+
This function always succeeds.
534+
535+
536+
.. c:function:: PyObject* PyFrozenDict_New(PyObject *iterable)
537+
538+
Return a new :class:`frozendict` from an iterable, or ``NULL`` on failure
539+
with an exception set.
540+
541+
Create an empty dictionary if *iterable* is ``NULL``.
542+
543+
544+
Ordered dictionaries
494545
^^^^^^^^^^^^^^^^^^^^
495546
496547
Python's C API provides interface for :class:`collections.OrderedDict` from C.

Doc/howto/enum.rst

Lines changed: 12 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -965,75 +965,16 @@ want one of them to be the value::
965965

966966

967967
Finer Points
968-
^^^^^^^^^^^^
969-
970-
Supported ``__dunder__`` names
971-
""""""""""""""""""""""""""""""
972-
973-
:attr:`~enum.EnumType.__members__` is a read-only ordered mapping of ``member_name``:``member``
974-
items. It is only available on the class.
975-
976-
:meth:`~object.__new__`, if specified, must create and return the enum members; it is
977-
also a very good idea to set the member's :attr:`~Enum._value_` appropriately. Once
978-
all the members are created it is no longer used.
979-
980-
981-
Supported ``_sunder_`` names
982-
""""""""""""""""""""""""""""
968+
------------
983969

984-
- :attr:`~Enum._name_` -- name of the member
985-
- :attr:`~Enum._value_` -- value of the member; can be set in ``__new__``
986-
- :meth:`~Enum._missing_` -- a lookup function used when a value is not found;
987-
may be overridden
988-
- :attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a
989-
:class:`str`, that will not be transformed into members, and will be removed
990-
from the final class
991-
- :meth:`~Enum._generate_next_value_` -- used to get an appropriate value for
992-
an enum member; may be overridden
993-
- :meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing
994-
member.
995-
- :meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an
996-
existing member. See `MultiValueEnum`_ for an example.
970+
Supported ``__dunder__`` and ``_sunder_`` names
971+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
997972

998-
.. note::
999-
1000-
For standard :class:`Enum` classes the next value chosen is the highest
1001-
value seen incremented by one.
1002-
1003-
For :class:`Flag` classes the next value chosen will be the next highest
1004-
power-of-two.
1005-
1006-
.. versionchanged:: 3.13
1007-
Prior versions would use the last seen value instead of the highest value.
1008-
1009-
.. versionadded:: 3.6 ``_missing_``, ``_order_``, ``_generate_next_value_``
1010-
.. versionadded:: 3.7 ``_ignore_``
1011-
.. versionadded:: 3.13 ``_add_alias_``, ``_add_value_alias_``
1012-
1013-
To help keep Python 2 / Python 3 code in sync an :attr:`~Enum._order_` attribute can
1014-
be provided. It will be checked against the actual order of the enumeration
1015-
and raise an error if the two do not match::
1016-
1017-
>>> class Color(Enum):
1018-
... _order_ = 'RED GREEN BLUE'
1019-
... RED = 1
1020-
... BLUE = 3
1021-
... GREEN = 2
1022-
...
1023-
Traceback (most recent call last):
1024-
...
1025-
TypeError: member order does not match _order_:
1026-
['RED', 'BLUE', 'GREEN']
1027-
['RED', 'GREEN', 'BLUE']
1028-
1029-
.. note::
1030-
1031-
In Python 2 code the :attr:`~Enum._order_` attribute is necessary as definition
1032-
order is lost before it can be recorded.
973+
The supported ``__dunder__`` and ``_sunder_`` names can be found in the :ref:`Enum API documentation <enum-dunder-sunder>`.
1033974

1034975

1035976
_Private__names
1036-
"""""""""""""""
977+
^^^^^^^^^^^^^^^
1037978

1038979
:ref:`Private names <private-name-mangling>` are not converted to enum members,
1039980
but remain normal attributes.
@@ -1042,7 +983,7 @@ but remain normal attributes.
1042983

1043984

1044985
``Enum`` member type
1045-
""""""""""""""""""""
986+
^^^^^^^^^^^^^^^^^^^^
1046987

1047988
Enum members are instances of their enum class, and are normally accessed as
1048989
``EnumClass.member``. In certain situations, such as writing custom enum
@@ -1055,7 +996,7 @@ recommended.
1055996

1056997

1057998
Creating members that are mixed with other data types
1058-
"""""""""""""""""""""""""""""""""""""""""""""""""""""
999+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10591000

10601001
When subclassing other data types, such as :class:`int` or :class:`str`, with
10611002
an :class:`Enum`, all values after the ``=`` are passed to that data type's
@@ -1069,7 +1010,7 @@ constructor. For example::
10691010

10701011

10711012
Boolean value of ``Enum`` classes and members
1072-
"""""""""""""""""""""""""""""""""""""""""""""
1013+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10731014

10741015
Enum classes that are mixed with non-:class:`Enum` types (such as
10751016
:class:`int`, :class:`str`, etc.) are evaluated according to the mixed-in
@@ -1084,7 +1025,7 @@ Plain :class:`Enum` classes always evaluate as :data:`True`.
10841025

10851026

10861027
``Enum`` classes with methods
1087-
"""""""""""""""""""""""""""""
1028+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10881029

10891030
If you give your enum subclass extra methods, like the `Planet`_
10901031
class below, those methods will show up in a :func:`dir` of the member,
@@ -1097,7 +1038,7 @@ but not of the class::
10971038

10981039

10991040
Combining members of ``Flag``
1100-
"""""""""""""""""""""""""""""
1041+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11011042

11021043
Iterating over a combination of :class:`Flag` members will only return the members that
11031044
are comprised of a single bit::
@@ -1117,7 +1058,7 @@ are comprised of a single bit::
11171058

11181059

11191060
``Flag`` and ``IntFlag`` minutia
1120-
""""""""""""""""""""""""""""""""
1061+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11211062

11221063
Using the following snippet for our examples::
11231064

@@ -1478,6 +1419,7 @@ alias::
14781419
behaviors as well as disallowing aliases. If the only desired change is
14791420
disallowing aliases, the :func:`unique` decorator can be used instead.
14801421

1422+
.. _multi-value-enum:
14811423

14821424
MultiValueEnum
14831425
^^^^^^^^^^^^^^^^^

Doc/library/datetime.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,8 +2534,8 @@ requires, and these work on all supported platforms.
25342534
| ``%d`` | Day of the month as a | 01, 02, ..., 31 | \(9) |
25352535
| | zero-padded decimal number. | | |
25362536
+-----------+--------------------------------+------------------------+-------+
2537-
| ``%D`` | Equivalent to ``%m/%d/%y``. | 11/10/2025 | \(9), |
2538-
| | | | \(0) |
2537+
| ``%D`` | Equivalent to ``%m/%d/%y``. | 11/28/25 | \(9) |
2538+
| | | | |
25392539
+-----------+--------------------------------+------------------------+-------+
25402540
| ``%e`` | The day of the month as a | ␣1, ␣2, ..., 31 | |
25412541
| | space-padded decimal number. | | |
@@ -2676,7 +2676,7 @@ differences between platforms in handling of unsupported format specifiers.
26762676
``%:z`` was added for :meth:`~.datetime.strftime`.
26772677

26782678
.. versionadded:: 3.15
2679-
``%:z`` and ``%F`` were added for :meth:`~.datetime.strptime`.
2679+
``%:z``, ``%F``, and ``%D`` were added for :meth:`~.datetime.strptime`.
26802680

26812681
Technical Detail
26822682
^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)