Skip to content

Commit 6777428

Browse files
committed
resolve conflict with main; Merge branch 'main' into product_ziplongest_vectorcall
2 parents 91b2638 + 6ed9dc2 commit 6777428

358 files changed

Lines changed: 9149 additions & 4301 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/workflows/build.yml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,10 @@ jobs:
266266
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
267267
# supported by important vendors such as AWS-LC.
268268
- { name: openssl, version: 1.1.1w }
269-
- { name: openssl, version: 3.4.8 }
270-
- { name: openssl, version: 3.5.9 }
271-
- { name: openssl, version: 3.6.5 }
272-
- { name: openssl, version: 4.0.3 }
269+
- { name: openssl, version: 3.5.10 }
270+
- { name: openssl, version: 4.0.4 }
273271
## AWS-LC
274-
- { name: aws-lc, version: 5.10.0 }
272+
- { name: aws-lc, version: 5.15.0 }
275273
env:
276274
SSLLIB_VER: ${{ matrix.ssllib.version }}
277275
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -386,7 +384,7 @@ jobs:
386384
needs: build-context
387385
if: needs.build-context.outputs.run-ubuntu == 'true'
388386
env:
389-
OPENSSL_VER: 3.5.9
387+
OPENSSL_VER: 3.5.10
390388
PYTHONSTRICTEXTENSIONBUILD: 1
391389
steps:
392390
- uses: actions/checkout@v7.0.1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
env:
1919
FORCE_COLOR: 1
20-
OPENSSL_VER: 3.5.9
20+
OPENSSL_VER: 3.5.10
2121

2222
jobs:
2323
build-san-reusable:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ inputs.os }}
3636
timeout-minutes: 60
3737
env:
38-
OPENSSL_VER: 3.5.9
38+
OPENSSL_VER: 3.5.10
3939
PYTHONSTRICTEXTENSIONBUILD: 1
4040
TERM: linux
4141
steps:

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*.orig
1818
*.pyc
1919
*.pyd
20-
*.pyo
2120
*.rej
2221
*.swp
2322
*.pickle

‎Doc/builtins/functions.rst‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2416,14 +2416,17 @@ are always available. They are listed here in alphabetical order.
24162416
This is an advanced function that is not needed in everyday Python
24172417
programming, unlike :func:`importlib.import_module`.
24182418

2419-
This function is invoked by the :keyword:`import` statement. It can be
2420-
replaced (by importing the :mod:`builtins` module and assigning to
2421-
``builtins.__import__``) in order to change semantics of the
2422-
:keyword:`!import` statement, but doing so is **strongly** discouraged as it
2423-
is usually simpler to use import hooks (see :pep:`302`) to attain the same
2424-
goals and does not cause issues with code which assumes the default import
2425-
implementation is in use. Direct use of :func:`__import__` is also
2426-
discouraged in favor of :func:`importlib.import_module`.
2419+
Eager :keyword:`import` statements call this function.
2420+
For :ref:`lazy imports <lazy-imports>`, Python calls this function at
2421+
resolution.
2422+
2423+
You can replace :func:`__import__` through an assignment to
2424+
``builtins.__import__``. :ref:`Import hooks <import-hooks>` usually provide a
2425+
simpler way to customize imports. A replacement can cause problems for code
2426+
that expects the default import implementation.
2427+
Do not replace :func:`__import__` unless import hooks cannot supply the
2428+
required behavior.
2429+
To import a module by name, use :func:`importlib.import_module`.
24272430

24282431
The function imports the module *name*, potentially using the given *globals*
24292432
and *locals* to determine how to interpret the name in a package context.

‎Doc/builtins/stdtypes.rst‎

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,23 @@ expression support in the :mod:`re` module).
25082508
Return ``True`` if all cased characters [4]_ in the string are lowercase and
25092509
there is at least one cased character, ``False`` otherwise.
25102510

2511+
For example:
2512+
2513+
.. doctest::
2514+
2515+
>>> 'banana'.islower()
2516+
True
2517+
>>> 'BANANA'.islower()
2518+
False
2519+
>>> 'baNana'.islower()
2520+
False
2521+
>>> ' '.islower()
2522+
False
2523+
>>> ''.islower()
2524+
False
2525+
2526+
See also :meth:`isupper` and :meth:`lower`.
2527+
25112528

25122529
.. method:: str.isnumeric()
25132530

@@ -2612,6 +2629,10 @@ expression support in the :mod:`re` module).
26122629
Return ``True`` if all cased characters [4]_ in the string are uppercase and
26132630
there is at least one cased character, ``False`` otherwise.
26142631

2632+
For example:
2633+
2634+
.. doctest::
2635+
26152636
>>> 'BANANA'.isupper()
26162637
True
26172638
>>> 'banana'.isupper()
@@ -2620,7 +2641,10 @@ expression support in the :mod:`re` module).
26202641
False
26212642
>>> ' '.isupper()
26222643
False
2644+
>>> ''.isupper()
2645+
False
26232646

2647+
See also :meth:`islower` and :meth:`upper`.
26242648

26252649

26262650
.. _meth-str-join:
@@ -2672,10 +2696,25 @@ expression support in the :mod:`re` module).
26722696
>>> 'Lower Method Example'.lower()
26732697
'lower method example'
26742698

2699+
Note that ``s.lower().islower()`` might be ``False`` if ``s``
2700+
contains uncased characters or if the Unicode category of the resulting
2701+
character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
2702+
titlecase).
2703+
2704+
For example, see the word "Python" written in Punjabi:
2705+
2706+
.. doctest::
2707+
2708+
>>> 'ازگر'.lower().islower()
2709+
False
2710+
2711+
26752712
The lowercasing algorithm used is `described in section 3.13.2 'Default Case
26762713
Conversion' of the Unicode Standard
26772714
<https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078>`__.
26782715

2716+
See also :meth:`islower` and :meth:`upper`.
2717+
26792718

26802719
.. method:: str.lstrip(chars=None, /)
26812720

@@ -3179,15 +3218,33 @@ expression support in the :mod:`re` module).
31793218
.. method:: str.upper()
31803219

31813220
Return a copy of the string with all the cased characters [4]_ converted to
3182-
uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s``
3221+
uppercase.
3222+
3223+
For example:
3224+
3225+
.. doctest::
3226+
3227+
>>> 'Upper Method Example'.upper()
3228+
'UPPER METHOD EXAMPLE'
3229+
3230+
Note that ``s.upper().isupper()`` might be ``False`` if ``s``
31833231
contains no cased characters or if the Unicode category of the resulting
3184-
character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
3232+
character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
31853233
titlecase).
31863234

3235+
For example, see the word "Python" written in Punjabi:
3236+
3237+
.. doctest::
3238+
3239+
>>> 'ازگر'.upper().isupper()
3240+
False
3241+
31873242
The uppercasing algorithm used is `described in section 3.13.2 'Default Case
31883243
Conversion' of the Unicode Standard
31893244
<https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078>`__.
31903245

3246+
See also :meth:`isupper` and :meth:`lower`.
3247+
31913248

31923249
.. method:: str.zfill(width, /)
31933250

‎Doc/c-api/import.rst‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,13 @@ Importing Modules
371371
372372
.. c:function:: int PyImport_SetLazyImportsFilter(PyObject *filter)
373373
374-
Sets the current lazy imports filter. The *filter* should be a callable that
375-
will receive ``(importing_module_name, imported_module_name, [fromlist])``
376-
when an import can potentially be lazy. The ``imported_module_name`` value
377-
is the resolved module name, so ``lazy from .spam import eggs`` passes
378-
``package.spam``. The callable must return ``True`` if the import should be
379-
lazy and ``False`` otherwise.
374+
Set the lazy import filter for the current interpreter.
375+
The *filter* must be a callable, ``NULL``, or :c:data:`Py_None`.
376+
Use ``NULL`` or :c:data:`Py_None` to clear the filter.
377+
The callable receives three positional arguments:
378+
``(importing_module_name, imported_module_name, fromlist)``.
379+
See :func:`sys.set_lazy_imports_filter` for the arguments and filter
380+
behavior.
380381
381382
Return ``0`` on success and ``-1`` with an exception set otherwise.
382383
@@ -388,11 +389,13 @@ Importing Modules
388389
389390
.. c:enumerator:: PyImport_LAZY_NORMAL
390391
391-
Respect the ``lazy`` keyword in source code. This is the default mode.
392+
Respect :keyword:`lazy` and :attr:`module.__lazy_modules__`.
393+
This is the default mode.
392394
393395
.. c:enumerator:: PyImport_LAZY_ALL
394396
395-
Make all imports lazy by default.
397+
Make eligible module-scope imports lazy by default.
398+
See the :ref:`lazy import restrictions <lazy-imports>`.
396399
397400
.. versionadded:: 3.15
398401

‎Doc/c-api/init_config.rst‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,9 +1607,11 @@ PyConfig
16071607
16081608
Control :ref:`lazy imports <lazy-imports>`.
16091609
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.
1610+
A value of ``-1`` selects the default behavior, which respects
1611+
:keyword:`lazy` and :attr:`module.__lazy_modules__`.
1612+
A value of ``1`` makes eligible module-scope imports lazy by default.
1613+
The :ref:`lazy import restrictions <lazy-imports>` apply in both modes.
1614+
A value of ``0`` is invalid.
16131615
16141616
Configured by the :option:`-X lazy_imports <-X>` command line option or
16151617
the :envvar:`PYTHON_LAZY_IMPORTS` environment variable.

‎Doc/c-api/intro.rst‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ System includes
140140
* ``<stdio.h>``
141141
* ``<stdlib.h>``
142142

143-
.. note::
144-
145-
Since Python may define some pre-processor definitions which affect the standard
146-
headers on some systems, you *must* include :file:`Python.h` before any standard
147-
headers are included.
148-
149143

150144
Useful macros
151145
=============

‎Doc/c-api/list.rst‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,107 @@ List Objects
227227
228228
Return a new tuple object containing the contents of *list*; equivalent to
229229
``tuple(list)``.
230+
231+
232+
.. _pylistbuilder:
233+
234+
PyListBuilder
235+
-------------
236+
237+
The :c:type:`PyListBuilder` API can be used to create a Python :class:`list`
238+
object.
239+
240+
On the free-threaded build, it's more efficient than the ``PyList`` C API to
241+
create a :class:`list`, because it can avoid the critical section on the
242+
created list.
243+
244+
.. versionadded:: next
245+
246+
247+
.. c:type:: PyListBuilder
248+
249+
A list builder object.
250+
251+
The API is **not thread safe**. To share a builder with multiple threads,
252+
external synchronization is needed.
253+
254+
The instance must be destroyed by :c:func:`PyListBuilder_Finish` on
255+
success, or :c:func:`PyListBuilder_Discard` on error.
256+
257+
258+
.. c:function:: PyListBuilder* PyListBuilder_Create(Py_ssize_t size)
259+
260+
Create a :c:type:`PyListBuilder` and preallocate *size* items.
261+
262+
On error, set an exception and return ``NULL``.
263+
264+
*size* must be positive or zero.
265+
266+
.. c:function:: PyObject* PyListBuilder_Finish(PyListBuilder *builder)
267+
268+
Finish a :c:type:`PyListBuilder` created by
269+
:c:func:`PyListBuilder_Create`.
270+
271+
On success, return a Python :class:`list` object.
272+
On error, set an exception and return ``NULL``.
273+
274+
The builder instance is invalid after the call in any case.
275+
No API can be called on the builder after :c:func:`PyListBuilder_Finish`.
276+
277+
.. c:function:: void PyListBuilder_Discard(PyListBuilder *builder)
278+
279+
Discard a :c:type:`PyListBuilder` created by :c:func:`PyListBuilder_Create`.
280+
281+
Do nothing if *builder* is ``NULL``.
282+
283+
The builder instance is invalid after the call.
284+
No API can be called on the builder after :c:func:`PyListBuilder_Discard`.
285+
286+
.. c:function:: int PyListBuilder_Append(PyListBuilder *builder, PyObject *item)
287+
288+
Append an item to the list builder.
289+
Similar to :c:func:`PyList_Append`.
290+
291+
On success, return ``0``.
292+
On error, set an exception, leave the builder unchanged, and return ``-1``.
293+
294+
.. c:function:: int PyListBuilder_AppendSteal(PyListBuilder *builder, PyObject *item)
295+
296+
Same as :c:func:`PyListBuilder_Append`, except this function
297+
:term:`steals <steal>` the reference to *item*.
298+
299+
.. c:function:: int PyListBuilder_Extend(PyListBuilder *builder, PyObject *iterable)
300+
301+
Extend the list builder with the contents of *iterable*.
302+
Similar to :c:func:`PyList_Extend`.
303+
304+
On success, return ``0``.
305+
On error, set an exception, leave the builder unchanged, and return ``-1``.
306+
307+
If consuming *iterable* raises an exception, the builder is restored to its
308+
previous state, that is, items added by a failed call are discarded.
309+
However, note that *iterable* is not reverted: items consumed from an
310+
iterator are not added back.
311+
312+
.. c:function:: int PyListBuilder_ExtendArray(PyListBuilder *builder, PyObject *const *items, Py_ssize_t nitem)
313+
314+
Extend the list builder with the contents of *items*: copy references from
315+
*items* to the list builder.
316+
317+
On success, return ``0``.
318+
On error, set an exception, leave the builder unchanged, and return ``-1``.
319+
320+
*nitem* must not be negative.
321+
322+
On failure, the builder is restored to its previous state. That is, items
323+
added by a failed call are discarded from the builder.
324+
325+
.. c:function:: int PyListBuilder_ExtendArraySteal(PyListBuilder *builder, PyObject *const *items, Py_ssize_t nitem)
326+
327+
Same as :c:func:`PyListBuilder_ExtendArray`, but :term:`steal` references
328+
instead of copying them.
329+
330+
The caller must hold a strong reference to each item in *item*.
331+
Both on success and on error, these references are transferred to the builder;
332+
the caller must not use them after the call.
333+
(To clarify: on error, the references are "lost".)

0 commit comments

Comments
 (0)