Skip to content

Commit 240467a

Browse files
committed
Merge remote-tracking branch 'origin/main' into ac-ssize-t-asssize
# Conflicts: # Modules/clinic/posixmodule.c.h
2 parents 136b091 + 0e671f2 commit 240467a

102 files changed

Lines changed: 2619 additions & 477 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:

‎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/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".)

‎Doc/data/stable_abi.dat‎

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Doc/library/asyncio-sync.rst‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ Lock
9292

9393
.. method:: locked()
9494

95-
Return ``True`` if the lock is *locked*.
95+
Return ``True`` if the lock can not be acquired immediately.
96+
97+
.. versionchanged:: next
98+
Also return ``True`` if the lock is *unlocked* but other tasks are
99+
waiting to acquire it.
96100

97101

98102
Event

‎Doc/library/concurrent.interpreters.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ objects are either directly shared or copied efficiently. For example:
189189
* :class:`str`
190190
* :class:`int`
191191
* :class:`float`
192+
* :class:`complex`
192193
* :class:`tuple` (of similarly supported objects)
193194

194195
There are a small number of Python types that actually share mutable

‎Doc/library/random.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ be found in any statistics text.
300300

301301
Return the next random floating-point number in the range ``0.0 <= X < 1.0``
302302

303+
The boolean expression ``random() < p`` is :const:`True` with probability
304+
``p``.
305+
303306

304307
.. function:: uniform(a, b)
305308

‎Doc/reference/lexical_analysis.rst‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,8 +1345,10 @@ Integer literals denote whole numbers. For example::
13451345
3
13461346
2147483647
13471347

1348-
There is no limit for the length of integer literals apart from what can be
1349-
stored in available memory::
1348+
There is a limit on the length of decimal integer literals via the
1349+
:ref:`integer string conversion length limitation <int_max_str_digits>` (4300
1350+
digits by default). If using binary, octal or hex bases there is no limit apart
1351+
from what can be stored in available memory::
13501352

13511353
7922816251426433759354395033679228162514264337593543950336
13521354

0 commit comments

Comments
 (0)