Skip to content

Commit 722fb00

Browse files
committed
Merge branch 'main' into nedbat/improve-docs-page
2 parents 6472b68 + 66da7bf commit 722fb00

File tree

161 files changed

+5277
-283
lines changed

Some content is hidden

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

161 files changed

+5277
-283
lines changed

.github/workflows/jit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ jobs:
7474
include:
7575
- target: i686-pc-windows-msvc/msvc
7676
architecture: Win32
77-
runner: windows-2022
77+
runner: windows-2025
7878
- target: x86_64-pc-windows-msvc/msvc
7979
architecture: x64
80-
runner: windows-2022
80+
runner: windows-2025
8181
- target: aarch64-pc-windows-msvc/msvc
8282
architecture: ARM64
8383
runner: windows-11-arm

.github/workflows/reusable-wasi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
timeout-minutes: 60
1414
env:
1515
WASMTIME_VERSION: 38.0.3
16-
WASI_SDK_VERSION: 29
16+
WASI_SDK_VERSION: 30
1717
WASI_SDK_PATH: /opt/wasi-sdk
1818
CROSS_BUILD_PYTHON: cross-build/build
1919
CROSS_BUILD_WASI: cross-build/wasm32-wasip1

.github/workflows/reusable-windows-msi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env:
1717
jobs:
1818
build:
1919
name: installer for ${{ inputs.arch }}
20-
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
20+
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025' }}
2121
timeout-minutes: 60
2222
env:
2323
ARCH: ${{ inputs.arch }}

.github/workflows/reusable-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
jobs:
2222
build:
2323
name: Build and test (${{ inputs.arch }})
24-
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2022' }}
24+
runs-on: ${{ inputs.arch == 'arm64' && 'windows-11-arm' || 'windows-2025' }}
2525
timeout-minutes: 60
2626
env:
2727
ARCH: ${{ inputs.arch }}

Doc/c-api/exceptions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,8 @@ Exception types
11191119
* :exc:`FloatingPointError`
11201120
* * .. c:var:: PyObject *PyExc_GeneratorExit
11211121
* :exc:`GeneratorExit`
1122+
* * .. c:var:: PyObject *PyExc_ImportCycleError
1123+
* :exc:`ImportCycleError`
11221124
* * .. c:var:: PyObject *PyExc_ImportError
11231125
* :exc:`ImportError`
11241126
* * .. c:var:: PyObject *PyExc_IndentationError

Doc/c-api/import.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,58 @@ Importing Modules
346346
347347
.. versionadded:: 3.14
348348
349+
.. c:function:: PyImport_LazyImportsMode PyImport_GetLazyImportsMode()
350+
351+
Gets the current lazy imports mode.
352+
353+
.. versionadded:: next
354+
355+
.. c:function:: PyObject* PyImport_GetLazyImportsFilter()
356+
357+
Return a :term:`strong reference` to the current lazy imports filter,
358+
or ``NULL`` if none exists. This function always succeeds.
359+
360+
.. versionadded:: next
361+
362+
.. c:function:: int PyImport_SetLazyImportsMode(PyImport_LazyImportsMode mode)
363+
364+
Similar to :c:func:`PyImport_ImportModuleAttr`, but names are UTF-8 encoded
365+
strings instead of Python :class:`str` objects.
366+
367+
This function always returns ``0``.
368+
369+
.. versionadded:: next
370+
371+
.. c:function:: int PyImport_SetLazyImportsFilter(PyObject *filter)
372+
373+
Sets the current lazy imports filter. The *filter* should be a callable that
374+
will receive ``(importing_module_name, imported_module_name, [fromlist])``
375+
when an import can potentially be lazy and that must return ``True`` if
376+
the import should be lazy and ``False`` otherwise.
377+
378+
Return ``0`` on success and ``-1`` with an exception set otherwise.
379+
380+
.. versionadded:: next
381+
382+
.. c:type:: PyImport_LazyImportsMode
383+
384+
Enumeration of possible lazy import modes.
385+
386+
.. c:enumerator:: PyImport_LAZY_NORMAL
387+
388+
Respect the ``lazy`` keyword in source code. This is the default mode.
389+
390+
.. c:enumerator:: PyImport_LAZY_ALL
391+
392+
Make all imports lazy by default.
393+
394+
.. c:enumerator:: PyImport_LAZY_NONE
395+
396+
Disable lazy imports entirely. Even explicit ``lazy`` statements become
397+
eager imports.
398+
399+
.. versionadded:: next
400+
349401
.. c:function:: PyObject* PyImport_CreateModuleFromInitfunc(PyObject *spec, PyObject* (*initfunc)(void))
350402
351403
This function is a building block that enables embedders to implement

Doc/c-api/intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ System includes
123123
* ``<limits.h>``
124124
* ``<math.h>``
125125
* ``<stdarg.h>``
126+
* ``<string.h>``
126127
* ``<wchar.h>``
127128
* ``<sys/types.h>`` (if present)
128129

@@ -138,7 +139,6 @@ System includes
138139
* ``<errno.h>``
139140
* ``<stdio.h>``
140141
* ``<stdlib.h>``
141-
* ``<string.h>``
142142

143143
.. note::
144144

Doc/library/ast.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,8 @@ Imports
11141114
names=[
11151115
alias(name='x'),
11161116
alias(name='y'),
1117-
alias(name='z')])])
1117+
alias(name='z')],
1118+
is_lazy=0)])
11181119

11191120

11201121
.. class:: ImportFrom(module, names, level)
@@ -1135,7 +1136,8 @@ Imports
11351136
alias(name='x'),
11361137
alias(name='y'),
11371138
alias(name='z')],
1138-
level=0)])
1139+
level=0,
1140+
is_lazy=0)])
11391141

11401142

11411143
.. class:: alias(name, asname)
@@ -1153,7 +1155,8 @@ Imports
11531155
names=[
11541156
alias(name='a', asname='b'),
11551157
alias(name='c')],
1156-
level=2)])
1158+
level=2,
1159+
is_lazy=0)])
11571160

11581161
Control flow
11591162
^^^^^^^^^^^^

Doc/library/datetime.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,6 +2689,12 @@ For the :meth:`.datetime.strptime` and :meth:`.date.strptime` class methods,
26892689
the default value is ``1900-01-01T00:00:00.000``: any components not specified
26902690
in the format string will be pulled from the default value.
26912691

2692+
.. note::
2693+
Format strings without separators can be ambiguous for parsing. For
2694+
example, with ``%Y%m%d``, the string ``2026111`` may be parsed either as
2695+
``2026-11-01`` or as ``2026-01-11``.
2696+
Use separators to ensure the input is parsed as intended.
2697+
26922698
.. note::
26932699
When used to parse partial dates lacking a year, :meth:`.datetime.strptime`
26942700
and :meth:`.date.strptime` will raise when encountering February 29 because

Doc/library/exceptions.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ The following exceptions are the exceptions that are usually raised.
266266

267267
.. versionadded:: 3.6
268268

269+
.. exception:: ImportCycleError
270+
271+
A subclass of :exc:`ImportError` which is raised when a lazy import fails
272+
because it (directly or indirectly) tries to import itself.
273+
274+
.. versionadded:: next
269275

270276
.. exception:: IndexError
271277

0 commit comments

Comments
 (0)