Skip to content

Commit 5bf07da

Browse files
committed
Merge remote-tracking branch 'origin/main' into longobject-vshift-vectorize
# Conflicts: # Objects/longobject.c
2 parents ccf5977 + 0d3ab6f commit 5bf07da

280 files changed

Lines changed: 7438 additions & 1836 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.

‎.github/CODEOWNERS‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,13 @@ Doc/library/importlib.resources.rst @jaraco @warsaw @FFY00
510510
Lib/importlib/resources/ @jaraco @warsaw @FFY00
511511
Lib/test/test_importlib/resources/ @jaraco @warsaw @FFY00
512512

513+
# IO
514+
Doc/library/io.rst @cmaloney
515+
Lib/_pyio.py @cmaloney
516+
Lib/io.py @cmaloney
517+
Lib/test/test_io/ @cmaloney
518+
Modules/_io/ @cmaloney
519+
513520
# Itertools
514521
Doc/library/itertools.rst @rhettinger
515522
Lib/test/test_itertools.py @rhettinger

‎.github/workflows/reusable-emscripten.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
f.write(f"node-version={config['node-version']}\n")
4040
f.write(f"deps-hash={h.hexdigest()}\n")
4141
with open(os.environ["GITHUB_ENV"], "a") as f:
42-
f.write(f"EMSDK_CACHE={emsdk_cache}\n")
42+
f.write(f"PY_EMSDK_CACHE={emsdk_cache}\n")
4343
- name: "Install Node.js"
4444
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
4545
with:
@@ -48,7 +48,7 @@ jobs:
4848
id: emsdk-cache
4949
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
5050
with:
51-
path: ${{ env.EMSDK_CACHE }}
51+
path: ${{ env.PY_EMSDK_CACHE }}
5252
key: emsdk-${{ steps.emscripten-config.outputs.emscripten-version }}-${{ steps.emscripten-config.outputs.deps-hash }}
5353
restore-keys: emsdk-${{ steps.emscripten-config.outputs.emscripten-version }}
5454
- name: "Install Python"

‎.github/workflows/reusable-macos.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
--enable-slower-safety \
5252
--enable-safety \
5353
${{ inputs.free-threading && '--disable-gil' || '' }} \
54+
--with-tail-call-interp \
5455
--prefix=/opt/python-dev \
5556
--with-openssl="$(brew --prefix openssl@3.5)"
5657
- name: Build CPython

‎.github/workflows/tail-call.yml‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,6 @@ env:
2323
LLVM_VERSION: 21
2424

2525
jobs:
26-
macos:
27-
name: aarch64-apple-darwin/clang
28-
runs-on: macos-26
29-
timeout-minutes: 60
30-
steps:
31-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
32-
with:
33-
persist-credentials: false
34-
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
35-
with:
36-
python-version: '3.11'
37-
- name: Install dependencies
38-
run: |
39-
brew update
40-
brew install llvm@${{ env.LLVM_VERSION }}
41-
- name: Build
42-
run: |
43-
export SDKROOT="$(xcrun --show-sdk-path)"
44-
export PATH="/opt/homebrew/opt/llvm@${{ env.LLVM_VERSION }}/bin:$PATH"
45-
CC=clang-${{ env.LLVM_VERSION }} ./configure --with-tail-call-interp
46-
make all --jobs 4
47-
- name: Test
48-
run: |
49-
./python.exe -m test --multiprocess 0 --timeout 4500 --verbose2 --verbose3
50-
5126
linux:
5227
name: ${{ matrix.target }}
5328
runs-on: ${{ matrix.runner }}

‎Doc/c-api/dict.rst‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,29 @@ Dictionary objects
507507
modified by another thread.
508508
509509
510+
.. c:function:: PyObject* PyDict_AsFrozenDictAndClear(PyObject *dict)
511+
512+
Return a new :class:`frozendict` created
513+
from the existing :class:`dict` instance.
514+
515+
Transfers all keys and values from *dict*
516+
to the newly allocated :class:`!frozendict`.
517+
Clears the input *dict* on success.
518+
Returns ``NULL`` with the exception set on error.
519+
520+
This function is intended for building a :class:`!frozendict` instance via
521+
a temporary *dict* that is not exposed to user code.
522+
To "freeze" an arbitrary dictionary, for example one received from the user
523+
as an argument, prefer :c:func:`PyFrozenDict_New` to leave the source
524+
intact.
525+
526+
.. impl-detail::
527+
528+
Works with O(1) complexity.
529+
530+
.. versionadded:: next
531+
532+
510533
.. c:function:: int PyDict_AddWatcher(PyDict_WatchCallback callback)
511534
512535
Register *callback* as a dictionary watcher. Return a non-negative integer

‎Doc/c-api/init_config.rst‎

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ UTF-8 encoded string. See :ref:`Configuration Options <pyinitconfig-opts>`.
155155
* Set *\*value*, and return ``0`` on success.
156156
* Set an error in *config* and return ``-1`` on error.
157157
158-
*\*value* can be set to ``NULL`` if the option is an optional string and the
159-
option is unset.
158+
*\*value* can be set to ``NULL`` if the option is unset or if the option is
159+
an optional string.
160+
Optional strings are documented with the type ``str | None`` in the
161+
:ref:`Configuration Options <pyinitconfig-opts>` table.
160162
161163
On success, the string must be released with ``free(value)`` if it's not
162164
``NULL``.
@@ -167,7 +169,7 @@ UTF-8 encoded string. See :ref:`Configuration Options <pyinitconfig-opts>`.
167169
Get a string list configuration option as an array of
168170
null-terminated UTF-8 encoded strings.
169171
170-
* Set *\*length* and *\*value*, and return ``0`` on success.
172+
* Set *\*length* and *\*items*, and return ``0`` on success.
171173
* Set an error in *config* and return ``-1`` on error.
172174
173175
On success, the string list must be released with
@@ -204,6 +206,9 @@ only implemented when ``Py_InitializeFromInitConfig()`` is called, not by the
204206
Set a string configuration option from a null-terminated UTF-8
205207
encoded string. The string is copied.
206208
209+
Options documented with the type ``str | None`` in the :ref:`Configuration
210+
Options <pyinitconfig-opts>` table can be set to ``NULL``.
211+
207212
* Return ``0`` on success.
208213
* Set an error in *config* and return ``-1`` on error.
209214
@@ -275,15 +280,15 @@ Configuration Options
275280
- Public
276281
* - ``"base_exec_prefix"``
277282
- :c:member:`base_exec_prefix <PyConfig.base_exec_prefix>`
278-
- ``str``
283+
- ``str | None``
279284
- Public
280285
* - ``"base_executable"``
281286
- :c:member:`base_executable <PyConfig.base_executable>`
282-
- ``str``
287+
- ``str | None``
283288
- Public
284289
* - ``"base_prefix"``
285290
- :c:member:`base_prefix <PyConfig.base_prefix>`
286-
- ``str``
291+
- ``str | None``
287292
- Public
288293
* - ``"buffered_stdio"``
289294
- :c:member:`buffered_stdio <PyConfig.buffered_stdio>`
@@ -331,15 +336,15 @@ Configuration Options
331336
- Read-only
332337
* - ``"dump_refs_file"``
333338
- :c:member:`dump_refs_file <PyConfig.dump_refs_file>`
334-
- ``str``
339+
- ``str | None``
335340
- Read-only
336341
* - ``"exec_prefix"``
337342
- :c:member:`exec_prefix <PyConfig.exec_prefix>`
338-
- ``str``
343+
- ``str | None``
339344
- Public
340345
* - ``"executable"``
341346
- :c:member:`executable <PyConfig.executable>`
342-
- ``str``
347+
- ``str | None``
343348
- Public
344349
* - ``"faulthandler"``
345350
- :c:member:`faulthandler <PyConfig.faulthandler>`
@@ -359,7 +364,7 @@ Configuration Options
359364
- Read-only
360365
* - ``"home"``
361366
- :c:member:`home <PyConfig.home>`
362-
- ``str``
367+
- ``str | None``
363368
- Read-only
364369
* - ``"import_time"``
365370
- :c:member:`import_time <PyConfig.import_time>`
@@ -385,6 +390,10 @@ Configuration Options
385390
- :c:member:`isolated <PyConfig.isolated>`
386391
- ``bool``
387392
- Read-only
393+
* - ``"lazy_imports"``
394+
- :c:member:`lazy_imports <PyConfig.lazy_imports>`
395+
- ``int``
396+
- Public
388397
* - ``"legacy_windows_fs_encoding"``
389398
- :c:member:`legacy_windows_fs_encoding <PyPreConfig.legacy_windows_fs_encoding>`
390399
- ``bool``
@@ -431,35 +440,35 @@ Configuration Options
431440
- Public
432441
* - ``"prefix"``
433442
- :c:member:`prefix <PyConfig.prefix>`
434-
- ``str``
443+
- ``str | None``
435444
- Public
436445
* - ``"program_name"``
437446
- :c:member:`program_name <PyConfig.program_name>`
438447
- ``str``
439448
- Read-only
440449
* - ``"pycache_prefix"``
441450
- :c:member:`pycache_prefix <PyConfig.pycache_prefix>`
442-
- ``str``
451+
- ``str | None``
443452
- Public
444453
* - ``"quiet"``
445454
- :c:member:`quiet <PyConfig.quiet>`
446455
- ``bool``
447456
- Public
448457
* - ``"run_command"``
449458
- :c:member:`run_command <PyConfig.run_command>`
450-
- ``str``
459+
- ``str | None``
451460
- Read-only
452461
* - ``"run_filename"``
453462
- :c:member:`run_filename <PyConfig.run_filename>`
454-
- ``str``
463+
- ``str | None``
455464
- Read-only
456465
* - ``"run_module"``
457466
- :c:member:`run_module <PyConfig.run_module>`
458-
- ``str``
467+
- ``str | None``
459468
- Read-only
460469
* - ``"run_presite"``
461470
- :c:member:`run_presite <PyConfig.run_presite>`
462-
- ``str``
471+
- ``str | None``
463472
- Read-only
464473
* - ``"safe_path"``
465474
- :c:member:`safe_path <PyConfig.safe_path>`
@@ -479,15 +488,15 @@ Configuration Options
479488
- Read-only
480489
* - ``"stdio_encoding"``
481490
- :c:member:`stdio_encoding <PyConfig.stdio_encoding>`
482-
- ``str``
491+
- ``str | None``
483492
- Read-only
484493
* - ``"stdio_errors"``
485494
- :c:member:`stdio_errors <PyConfig.stdio_errors>`
486495
- ``str``
487496
- Read-only
488497
* - ``"stdlib_dir"``
489498
- :c:member:`stdlib_dir <PyConfig.stdlib_dir>`
490-
- ``str``
499+
- ``str | None``
491500
- Public
492501
* - ``"tracemalloc"``
493502
- :c:member:`tracemalloc <PyConfig.tracemalloc>`
@@ -542,6 +551,9 @@ Configuration Options
542551
- ``bool``
543552
- Read-only
544553
554+
The type ``str | None`` means that the option is an optional string which can
555+
be set to ``NULL``.
556+
545557
Visibility:
546558
547559
* Public: Can be retrieved by :c:func:`PyConfig_Get` and set by
@@ -1591,6 +1603,21 @@ PyConfig
15911603
See also the :ref:`Isolated Configuration <init-isolated-conf>` and
15921604
:c:member:`PyPreConfig.isolated`.
15931605
1606+
.. c:member:: int lazy_imports
1607+
1608+
Control :ref:`lazy imports <lazy-imports>`.
1609+
1610+
A value of ``-1`` keeps the default behaviour, where only imports marked
1611+
with the ``lazy`` keyword are lazy. A value of ``1`` makes every import
1612+
lazy. ``0`` is rejected.
1613+
1614+
Configured by the :option:`-X lazy_imports <-X>` command line option or
1615+
the :envvar:`PYTHON_LAZY_IMPORTS` environment variable.
1616+
1617+
Default: ``-1``.
1618+
1619+
.. versionadded:: 3.15
1620+
15941621
.. c:member:: int legacy_windows_stdio
15951622
15961623
If non-zero, use :class:`io.FileIO` instead of
@@ -1948,7 +1975,7 @@ PyConfig
19481975
If equals to zero, ignore the :ref:`environment variables
19491976
<using-on-envvars>`.
19501977
1951-
Set to ``0`` by the :option:`-E` environment variable.
1978+
Set to ``0`` by the :option:`-E` command-line option.
19521979
19531980
Default: ``1`` in Python config and ``0`` in isolated config.
19541981

‎Doc/c-api/interp-lifecycle.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,9 @@ Process-wide parameters
575575
formed from the "official" name of the operating system, converted to lower
576576
case, followed by the major revision number; e.g., for Solaris 2.x, which is
577577
also known as SunOS 5.x, the value is ``'sunos5'``. On macOS, it is
578-
``'darwin'``. On Windows, it is ``'win'``. The returned string points into
579-
static storage; the caller should not modify its value. The value is available
580-
to Python code as ``sys.platform``.
578+
``'darwin'``. On Windows, it is ``'win32'``. The returned string points
579+
into static storage; the caller should not modify its value. The value is
580+
available to Python code as ``sys.platform``.
581581
582582
583583
.. c:function:: const char* Py_GetCopyright()

‎Doc/c-api/long.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
596596
Macro for converting a Python integer into a process identifier.
597597
598598
This can be defined as an alias to :c:func:`PyLong_AsLong`,
599-
:c:func:`PyLong_FromLongLong`, or :c:func:`PyLong_AsInt`, depending on the
599+
:c:func:`PyLong_AsLongLong`, or :c:func:`PyLong_AsInt`, depending on the
600600
size of the system's PID type.
601601
602602
.. versionadded:: 3.2

‎Doc/c-api/module.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Creation and initialization slots
337337
338338
.. versionchanged:: 3.15
339339
340-
The *slots* argument may be a ``ModuleSpec``-like object, rather than
340+
The *spec* argument may be a ``ModuleSpec``-like object, rather than
341341
a true :py:class:`~importlib.machinery.ModuleSpec` instance.
342342
Note that previous versions of CPython did not enforce this.
343343

‎Doc/c-api/slots.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Convenience macros
197197
{NAME, PySlot_INTPTR, {0}, {(void*)(VALUE)}}
198198

199199
#define PySlot_PTR_STATIC(NAME, VALUE) \
200-
{NAME, PySlot_INTPTR|Py_SLOT_STATIC, {0}, {(void*)(VALUE)}}
200+
{NAME, PySlot_INTPTR|PySlot_STATIC, {0}, {(void*)(VALUE)}}
201201

202202
.. versionadded:: 3.15
203203

0 commit comments

Comments
 (0)