Skip to content

Commit da3630b

Browse files
authored
Merge branch 'main' into bugifx
2 parents d84652c + 1bfcc3c commit da3630b

297 files changed

Lines changed: 11577 additions & 6307 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ Lib/test/test_unittest/testmock/ @cjw296
630630
Doc/library/zlib.rst @StanFromIreland
631631
Lib/compression/zlib.py @StanFromIreland
632632
Lib/test/test_zlib.py @StanFromIreland
633-
Modules/_zlibmodule.c @StanFromIreland
633+
Modules/zlibmodule.c @StanFromIreland
634634

635635
# Zipfile.Path
636636
Lib/test/test_zipfile/_path/ @jaraco

.github/workflows/reusable-docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ jobs:
8686
--fail-if-regression \
8787
--fail-if-improved \
8888
--fail-if-new-news-nit
89+
- name: 'Build list of changes'
90+
run: |
91+
make -C Doc/ PYTHON=../python changes
8992
- name: 'Collect HTML IDs'
9093
if: github.event_name == 'pull_request'
9194
run: python Doc/tools/check-html-ids.py collect Doc/build/html -o Doc/build/html-ids-head.json.gz
File renamed without changes.
File renamed without changes.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ are always available. They are listed here in alphabetical order.
129129
anext(async_iterator, default, /)
130130

131131
When awaited, return the next item from the given :term:`asynchronous
132-
iterator`, or *default* if given and the iterator is exhausted.
132+
iterator`, or *default* if given and the iterator is :term:`exhausted`.
133133

134134
This is the async variant of the :func:`next` builtin, and behaves
135135
similarly.
@@ -1223,7 +1223,7 @@ are always available. They are listed here in alphabetical order.
12231223
process_block(block)
12241224

12251225
*stop_exception* is useful for callables
1226-
which report exhaustion by raising an exception
1226+
which report :term:`exhaustion <exhausted>` by raising an exception
12271227
instead of returning a special value.
12281228
For example, draining a queue::
12291229

@@ -1315,7 +1315,7 @@ are always available. They are listed here in alphabetical order.
13151315
yielding the results. If additional *iterables* arguments are passed,
13161316
*function* must take that many arguments and is applied to the items from all
13171317
iterables in parallel. With multiple iterables, the iterator stops when the
1318-
shortest iterable is exhausted. If *strict* is ``True`` and one of the
1318+
shortest iterable is :term:`exhausted`. If *strict* is ``True`` and one of the
13191319
iterables is exhausted before the others, a :exc:`ValueError` is raised. For
13201320
cases where the function inputs are already arranged into argument tuples,
13211321
see :func:`itertools.starmap`.
@@ -1397,7 +1397,7 @@ are always available. They are listed here in alphabetical order.
13971397

13981398
Retrieve the next item from the :term:`iterator` by calling its
13991399
:meth:`~iterator.__next__` method. If *default* is given, it is returned
1400-
if the iterator is exhausted, otherwise :exc:`StopIteration` is raised.
1400+
if the iterator is :term:`exhausted`, otherwise :exc:`StopIteration` is raised.
14011401

14021402

14031403
.. class:: object()
@@ -2312,7 +2312,7 @@ are always available. They are listed here in alphabetical order.
23122312
the code that prepared these iterables. Python offers three different
23132313
approaches to dealing with this issue:
23142314

2315-
* By default, :func:`zip` stops when the shortest iterable is exhausted.
2315+
* By default, :func:`zip` stops when the shortest iterable is :term:`exhausted`.
23162316
It will ignore the remaining items in the longer iterables, cutting off
23172317
the result to the length of the shortest iterable::
23182318

@@ -2327,7 +2327,7 @@ are always available. They are listed here in alphabetical order.
23272327
[('a', 1), ('b', 2), ('c', 3)]
23282328

23292329
Unlike the default behavior, it raises a :exc:`ValueError` if one iterable
2330-
is exhausted before the others:
2330+
is :term:`exhausted` before the others:
23312331

23322332
>>> for item in zip(range(3), ['fee', 'fi', 'fo', 'fum'], strict=True): # doctest: +SKIP
23332333
... print(item)

Doc/builtins/index.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _builtins-index:
2+
3+
##############################
4+
Python built-ins reference
5+
##############################
6+
7+
Python comes with a number of built-in functions and classes.
8+
9+
The built-in classes include data types that would normally be considered part
10+
of the "core" of a language, such as numbers and lists. For these types, the
11+
Python language core defines the form of literals and places some constraints
12+
on their semantics, but does not fully define the semantics.
13+
14+
The built-ins also include functions and exceptions --- objects that can
15+
be used by all Python code without the need of an :keyword:`import` statement.
16+
Some of these are defined by the core language, but many are not essential for
17+
the core semantics and are only described here.
18+
19+
.. seealso::
20+
21+
In addition to the built-ins, Python provides an extensive importable
22+
standard library, see :ref:`library-index`.
23+
24+
.. We don't use :numbered: option for the TOC below as it enforces
25+
numbered sections for the entire builtin docs. If desired,
26+
:numbered: can be enabled on a per-page basis.
27+
.. toctree::
28+
:maxdepth: 2
29+
30+
stdtypes.rst
31+
constants.rst
32+
functions.rst
33+
exceptions.rst
34+
threadsafety.rst
35+
time-complexity.rst
File renamed without changes.
File renamed without changes.
File renamed without changes.

Doc/c-api/bytes.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ called with a non-bytes parameter.
231231
Resize a bytes object. *newsize* will be the new length of the bytes object.
232232
You can think of it as creating a new bytes object and destroying the old
233233
one, only more efficiently.
234+
234235
Pass the address of an
235236
existing bytes object as an lvalue (it may be written into), and the new size
236237
desired. On success, *\*bytes* holds the resized bytes object and ``0`` is
@@ -239,6 +240,11 @@ called with a non-bytes parameter.
239240
*\*bytes* is set to ``NULL``, :exc:`MemoryError` is set, and ``-1`` is
240241
returned.
241242
243+
While bytes objects are usually immutable in Python, this special C API
244+
allows mutating a bytes object in-place. The returned bytes object can still
245+
be mutated using :c:func:`PyBytesWriter_GetData`; except if *newsize* is
246+
zero in which case it returns the immutable empty bytes string.
247+
242248
.. soft-deprecated:: 3.15
243249
Use the :c:type:`PyBytesWriter` API instead.
244250
@@ -290,10 +296,10 @@ object.
290296
291297
.. c:type:: PyBytesWriter
292298
293-
A bytes writer instance.
299+
A bytes writer object.
294300
295-
The API is **not thread safe**: a writer should only be used by a single
296-
thread at the same time.
301+
The API is **not thread safe**. A :c:type:`PyBytesWriter` object must only
302+
be used by a single thread, it must not be shared between threads.
297303
298304
The instance must be destroyed by :c:func:`PyBytesWriter_Finish` on
299305
success, or :c:func:`PyBytesWriter_Discard` on error.
@@ -429,7 +435,7 @@ Low-level API
429435
On success, return ``0``.
430436
On error, set an exception and return ``-1``.
431437
432-
*size* can be negative to shrink the writer.
438+
*grow* can be negative to shrink the writer.
433439
434440
.. c:function:: void* PyBytesWriter_GrowAndUpdatePointer(PyBytesWriter *writer, Py_ssize_t size, void *buf)
435441

0 commit comments

Comments
 (0)