Skip to content

Commit bd5cec6

Browse files
Merge branch 'main' into gh-157058-waitfor
2 parents 97add69 + 392ad7e commit bd5cec6

183 files changed

Lines changed: 4762 additions & 1449 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.

Doc/c-api/module.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ struct:
853853
854854
.. versionadded:: 3.5
855855
856-
.. soft-deprecated:: next
856+
.. soft-deprecated:: 3.15
857857
858858
Prefer :c:func:`PyModule_FromSlotsAndSpec` in new code.
859859
@@ -877,7 +877,7 @@ struct:
877877
878878
.. versionadded:: 3.5
879879
880-
.. soft-deprecated:: next
880+
.. soft-deprecated:: 3.15
881881
882882
Prefer :c:func:`PyModule_FromSlotsAndSpec` in new code.
883883
@@ -887,7 +887,7 @@ struct:
887887
888888
.. versionadded:: 3.5
889889
890-
.. soft-deprecated:: next
890+
.. soft-deprecated:: 3.15
891891
892892
To run a module's own execution slots, prefer :c:func:`PyModule_Exec`,
893893
which works on modules that were not created from a

Doc/c-api/type.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ They will continue to work, but new features will be added as slots for
828828
829829
.. versionadded:: 3.12
830830
831-
.. soft-deprecated:: next
831+
.. soft-deprecated:: 3.15
832832
833833
Prefer :c:func:`PyType_FromSlots` in new code.
834834
@@ -859,7 +859,7 @@ They will continue to work, but new features will be added as slots for
859859
Creating classes whose metaclass overrides
860860
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
861861
862-
.. soft-deprecated:: next
862+
.. soft-deprecated:: 3.15
863863
864864
Prefer :c:func:`PyType_FromSlots` in new code.
865865
@@ -885,7 +885,7 @@ They will continue to work, but new features will be added as slots for
885885
Creating classes whose metaclass overrides
886886
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
887887
888-
.. soft-deprecated:: next
888+
.. soft-deprecated:: 3.15
889889
890890
Prefer :c:func:`PyType_FromSlots` in new code.
891891
@@ -910,7 +910,7 @@ They will continue to work, but new features will be added as slots for
910910
Creating classes whose metaclass overrides
911911
:c:member:`~PyTypeObject.tp_new` is no longer allowed.
912912
913-
.. soft-deprecated:: next
913+
.. soft-deprecated:: 3.15
914914
915915
Prefer :c:func:`PyType_FromSlots` in new code.
916916

Doc/c-api/typeobj.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,9 +1869,10 @@ and :c:data:`PyType_Type` effectively act as defaults.)
18691869

18701870
PyObject *tp_iternext(PyObject *self);
18711871

1872-
When the iterator is exhausted, it must return ``NULL``; a :exc:`StopIteration`
1873-
exception may or may not be set. When another error occurs, it must return
1874-
``NULL`` too. Its presence signals that the instances of this type are
1872+
When the iterator is :term:`exhausted`, the ``tp_iternext`` function must
1873+
return ``NULL``; a :exc:`StopIteration` exception may or may not be set.
1874+
When another error occurs, it must return ``NULL`` too.
1875+
The presence of ``tp_iternext`` signals that the instances of this type are
18751876
iterators.
18761877

18771878
Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` function, and that

Doc/glossary.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,14 @@ Glossary
505505
of an object, such as the value of type aliases created with the :keyword:`type`
506506
statement.
507507

508+
exhausted
509+
An :term:`iterator` that has produced all of its values is said to be
510+
:dfn:`exhausted`.
511+
Further attempts to get the next value (for example, calls to
512+
:func:`next`) raise :exc:`StopIteration`
513+
(or :exc:`StopAsyncIteration` in the case of an :term:`asynchronous
514+
iterator`).
515+
508516
expression
509517
A piece of syntax which can be evaluated to some value. In other words,
510518
an expression is an accumulation of expression elements like literals,
@@ -869,7 +877,7 @@ Glossary
869877
:meth:`~iterator.__next__` method (or passing it to the built-in function
870878
:func:`next`) return successive items in the stream. When no more data
871879
are available a :exc:`StopIteration` exception is raised instead. At this
872-
point, the iterator object is exhausted and any further calls to its
880+
point, the iterator object is :term:`exhausted` and any further calls to its
873881
:meth:`!__next__` method just raise :exc:`StopIteration` again. Iterators
874882
are required to have an :meth:`~iterator.__iter__` method that returns the iterator
875883
object itself so every iterator is also iterable and may be used in most

Doc/howto/functional.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,9 +720,10 @@ returns them in a tuple::
720720
zip(['a', 'b', 'c'], (1, 2, 3)) =>
721721
('a', 1), ('b', 2), ('c', 3)
722722

723-
It doesn't construct an in-memory list and exhaust all the input iterators
724-
before returning; instead tuples are constructed and returned only if they're
725-
requested. (The technical term for this behaviour is `lazy evaluation
723+
It doesn't construct an in-memory list and :term:`exhaust <exhausted>` all
724+
the input iterators before returning; instead tuples are constructed and
725+
returned only if they're requested.
726+
(The technical term for this behaviour is `lazy evaluation
726727
<https://en.wikipedia.org/wiki/Lazy_evaluation>`__.)
727728

728729
This iterator is intended to be used with iterables that are all of the same
@@ -783,7 +784,7 @@ element *n* times, or returns the element endlessly if *n* is not provided. ::
783784
:func:`itertools.chain(iterA, iterB, ...) <itertools.chain>` takes an arbitrary
784785
number of iterables as input, and returns all the elements of the first
785786
iterator, then all the elements of the second, and so on, until all of the
786-
iterables have been exhausted. ::
787+
iterables have been :term:`exhausted`. ::
787788

788789
itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>
789790
a, b, c, 1, 2, 3
@@ -878,7 +879,7 @@ iterable's results. ::
878879

879880
:func:`itertools.compress(data, selectors) <itertools.compress>` takes two
880881
iterators and returns only those elements of *data* for which the corresponding
881-
element of *selectors* is true, stopping whenever either one is exhausted::
882+
element of *selectors* is true, stopping whenever either one is :term:`exhausted`::
882883

883884
itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>
884885
1, 2, 5
@@ -1028,7 +1029,7 @@ that takes two elements and returns a single value. :func:`functools.reduce`
10281029
takes the first two elements A and B returned by the iterator and calculates
10291030
``func(A, B)``. It then requests the third element, C, calculates
10301031
``func(func(A, B), C)``, combines this result with the fourth element returned,
1031-
and continues until the iterable is exhausted. If the iterable returns no
1032+
and continues until the iterable is :term:`exhausted`. If the iterable returns no
10321033
values at all, a :exc:`TypeError` exception is raised. If the initial value is
10331034
supplied, it's used as a starting point and ``func(initial_value, A)`` is the
10341035
first calculation. ::

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3920,7 +3920,7 @@ subclassed handler which looks something like this::
39203920

39213921
You'll need to be familiar with RFC 5424 to fully understand the above code, and it
39223922
may be that you have slightly different needs (e.g. for how you pass structural data
3923-
to the log). Nevertheless, the above should be adaptable to your speciric needs. With
3923+
to the log). Nevertheless, the above should be adaptable to your specific needs. With
39243924
the above handler, you'd pass structured data using something like this::
39253925

39263926
sd = {

Doc/howto/mro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ prescription:
189189
the tail of any of the other lists, then add it to the linearization
190190
of C and remove it from the lists in the merge, otherwise look at the
191191
head of the next list and take it, if it is a good head. Then repeat
192-
the operation until all the class are removed or it is impossible to
192+
the operation until all the classes are removed or it is impossible to
193193
find good heads. In this case, it is impossible to construct the
194194
merge, Python 2.3 will refuse to create the class C and will raise an
195195
exception.*

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ added elements by appending to the right and popping to the left::
699699
A `round-robin scheduler
700700
<https://en.wikipedia.org/wiki/Round-robin_scheduling>`_ can be implemented with
701701
input iterators stored in a :class:`deque`. Values are yielded from the active
702-
iterator in position zero. If that iterator is exhausted, it can be removed
702+
iterator in position zero. If that iterator is :term:`exhausted`, it can be removed
703703
with :meth:`~deque.popleft`; otherwise, it can be cycled back to the end with
704704
the :meth:`~deque.rotate` method::
705705

Doc/library/colorsys.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spaces, the coordinates are all between 0 and 1.
1919
.. seealso::
2020

2121
More information about color spaces can be found at
22-
https://poynton.ca/ColorFAQ.html and
22+
https://www.poynton.ca/pdf/ColourFAQ.pdf and
2323
https://www.cambridgeincolour.com/tutorials/color-spaces.htm.
2424

2525
The :mod:`!colorsys` module defines the following functions:

Doc/library/ctypes.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ Specifying function pointers using type annotations
708708

709709
@wrap_dll_function(dll_to_wrap)
710710
def function_ptr_name(arg_name: ctypes_type, ...) -> ctypes_type:
711-
"""Optional docstring. There should be no function body."""
711+
"""Optional docstring. There should be no function body."""
712712

713713
The body of the decorated function is ignored, and any parameters that are
714714
missing type annotations are skipped. The names of the parameters are ignored
@@ -728,7 +728,7 @@ Specifying function pointers using type annotations
728728

729729
@wrap_dll_function(ctypes.pythonapi)
730730
def PyObject_GetAttrString(op: ctypes.py_object, attr: ctypes.c_char_p) -> ctypes.py_object:
731-
pass
731+
pass
732732

733733
PyObject_GetAttrString(42, b"real")
734734

@@ -3207,7 +3207,7 @@ fields, or any other data types containing pointer type fields.
32073207
that should be merged into a containing structure or union.
32083208

32093209

3210-
.. decorator:: struct(*, align=None, layout, endian='native', pack=None)
3210+
.. decorator:: struct(*, align=None, layout=None, endian='native', pack=None)
32113211
:module: ctypes.util
32123212

32133213
A :term:`decorator` that allows generating structure types using an
@@ -3244,14 +3244,18 @@ fields, or any other data types containing pointer type fields.
32443244

32453245
.. code-block:: python
32463246
3247+
from typing import Annotated
3248+
from ctypes import c_ssize_t, c_void_p
3249+
from ctypes.util import struct, CFieldInfo
3250+
32473251
@struct
32483252
class PyObject:
3249-
ob_refcnt: c_ssize_t
3250-
ob_type: c_void_p
3253+
ob_refcnt: c_ssize_t
3254+
ob_type: c_void_p
32513255
32523256
@struct
32533257
class PyHovercraftObject:
3254-
ob_base: Annotated[PyObject, CFieldInfo(anonymous=True)]
3258+
ob_base: Annotated[PyObject, CFieldInfo(anonymous=True)]
32553259
32563260
.. versionadded:: next
32573261

0 commit comments

Comments
 (0)