Skip to content

Commit 9c37bcf

Browse files
authored
Merge branch 'main' into copy_deepcopy_ft
2 parents 4c7c42b + 06f8d7a commit 9c37bcf

70 files changed

Lines changed: 957 additions & 810 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ repos:
2222
name: Run Ruff (lint) on Argument Clinic
2323
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
2424
files: ^Tools/clinic/|Lib/test/test_clinic.py
25+
- id: ruff
26+
name: Run Ruff (lint) on Tools/peg_generator/
27+
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
28+
files: ^Tools/peg_generator/
2529
- id: ruff-format
2630
name: Run Ruff (format) on Doc/
2731
args: [--check]

Doc/extending/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ A pointer to the module definition must be returned via :c:func:`PyModuleDef_Ini
426426
so that the import machinery can create the module and store it in ``sys.modules``.
427427

428428
When embedding Python, the :c:func:`!PyInit_spam` function is not called
429-
automatically unless there's an entry in the :c:data:`PyImport_Inittab` table.
429+
automatically unless there's an entry in the :c:data:`!PyImport_Inittab` table.
430430
To add the module to the initialization table, use :c:func:`PyImport_AppendInittab`,
431431
optionally followed by an import of the module::
432432

Doc/glossary.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ Glossary
2121
right delimiters (parentheses, square brackets, curly braces or triple
2222
quotes), or after specifying a decorator.
2323

24-
* The :const:`Ellipsis` built-in constant.
24+
.. index:: single: ...; ellipsis literal
25+
26+
* The three dots form of the :ref:`Ellipsis <bltin-ellipsis-object>` object.
2527

2628
abstract base class
2729
Abstract base classes complement :term:`duck-typing` by

Doc/library/collections.abc.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,17 @@ Collections Abstract Base Classes -- Detailed Descriptions
272272
linked list), the mixins will have quadratic performance and will
273273
likely need to be overridden.
274274

275-
.. versionchanged:: 3.5
276-
The index() method added support for *stop* and *start*
277-
arguments.
275+
.. method:: index(value, start=0, stop=None)
276+
277+
Return first index of *value*.
278+
279+
Raises :exc:`ValueError` if the value is not present.
280+
281+
Supporting the *start* and *stop* arguments is optional, but recommended.
282+
283+
.. versionchanged:: 3.5
284+
The :meth:`!index` method added support for *stop* and *start*
285+
arguments.
278286

279287
.. class:: Set
280288
MutableSet

Doc/library/constants.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ A small number of constants live in the built-in namespace. They are:
6565
.. index:: single: ...; ellipsis literal
6666
.. data:: Ellipsis
6767

68-
The same as the ellipsis literal "``...``". Special value used mostly in conjunction
69-
with extended slicing syntax for user-defined container data types.
68+
The same as the ellipsis literal "``...``", an object frequently used to
69+
indicate that something is omitted. Assignment to ``Ellipsis`` is possible, but
70+
assignment to ``...`` raises a :exc:`SyntaxError`.
7071
``Ellipsis`` is the sole instance of the :data:`types.EllipsisType` type.
7172

7273

Doc/library/curses.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,10 @@ The module :mod:`curses` defines the following functions:
716716
Window Objects
717717
--------------
718718

719-
Window objects, as returned by :func:`initscr` and :func:`newwin` above, have
720-
the following methods and attributes:
719+
.. class:: window
720+
721+
Window objects, as returned by :func:`initscr` and :func:`newwin` above, have
722+
the following methods and attributes:
721723

722724

723725
.. method:: window.addch(ch[, attr])

Doc/library/shutil.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ Directory and files operations
9090
copy the file more efficiently. See
9191
:ref:`shutil-platform-dependent-efficient-copy-operations` section.
9292

93+
.. exception:: SpecialFileError
94+
95+
This exception is raised when :func:`copyfile` or :func:`copytree` attempt
96+
to copy a named pipe.
97+
98+
.. versionadded:: 2.7
99+
93100
.. exception:: SameFileError
94101

95102
This exception is raised if source and destination in :func:`copyfile`

Doc/library/stdtypes.rst

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5869,13 +5869,34 @@ It is written as ``None``.
58695869
The Ellipsis Object
58705870
-------------------
58715871

5872-
This object is commonly used by slicing (see :ref:`slicings`). It supports no
5873-
special operations. There is exactly one ellipsis object, named
5872+
This object is commonly used used to indicate that something is omitted.
5873+
It supports no special operations. There is exactly one ellipsis object, named
58745874
:const:`Ellipsis` (a built-in name). ``type(Ellipsis)()`` produces the
58755875
:const:`Ellipsis` singleton.
58765876

58775877
It is written as ``Ellipsis`` or ``...``.
58785878

5879+
In typical use, ``...`` as the ``Ellipsis`` object appears in a few different
5880+
places, for instance:
5881+
5882+
- In type annotations, such as :ref:`callable arguments <annotating-callables>`
5883+
or :ref:`tuple elements <annotating-tuples>`.
5884+
5885+
- As the body of a function instead of a :ref:`pass statement <tut-pass>`.
5886+
5887+
- In third-party libraries, such as `Numpy's slicing and striding
5888+
<https://numpy.org/doc/stable/user/basics.indexing.html#slicing-and-striding>`_.
5889+
5890+
Python also uses three dots in ways that are not ``Ellipsis`` objects, for instance:
5891+
5892+
- Doctest's :const:`ELLIPSIS <doctest.ELLIPSIS>`, as a pattern for missing content.
5893+
5894+
- The default Python prompt of the :term:`interactive` shell when partial input is incomplete.
5895+
5896+
Lastly, the Python documentation often uses three dots in conventional English
5897+
usage to mean omitted content, even in code examples that also use them as the
5898+
``Ellipsis``.
5899+
58795900

58805901
.. _bltin-notimplemented-object:
58815902

Doc/library/test.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ The :mod:`test.support` module defines the following functions:
851851
Decorator for tests that fill the address space.
852852

853853

854-
.. function:: linked_with_musl()
854+
.. function:: linked_to_musl()
855855

856856
Return ``False`` if there is no evidence the interpreter was compiled with
857857
``musl``, otherwise return a version triple, either ``(0, 0, 0)`` if the

Doc/library/typing.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,11 @@ For example:
230230

231231
callback: Callable[[str], Awaitable[None]] = on_update
232232

233+
.. index:: single: ...; ellipsis literal
234+
233235
The subscription syntax must always be used with exactly two values: the
234236
argument list and the return type. The argument list must be a list of types,
235-
a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis. The return type must
237+
a :class:`ParamSpec`, :data:`Concatenate`, or an ellipsis (``...``). The return type must
236238
be a single type.
237239

238240
If a literal ellipsis ``...`` is given as the argument list, it indicates that
@@ -375,8 +377,11 @@ accepts *any number* of type arguments::
375377
# but ``z`` has been assigned to a tuple of length 3
376378
z: tuple[int] = (1, 2, 3)
377379

380+
.. index:: single: ...; ellipsis literal
381+
378382
To denote a tuple which could be of *any* length, and in which all elements are
379-
of the same type ``T``, use ``tuple[T, ...]``. To denote an empty tuple, use
383+
of the same type ``T``, use the literal ellipsis ``...``: ``tuple[T, ...]``.
384+
To denote an empty tuple, use
380385
``tuple[()]``. Using plain ``tuple`` as an annotation is equivalent to using
381386
``tuple[Any, ...]``::
382387

@@ -1162,6 +1167,8 @@ These can be used as types in annotations. They all support subscription using
11621167

11631168
Special form for annotating higher-order functions.
11641169

1170+
.. index:: single: ...; ellipsis literal
1171+
11651172
``Concatenate`` can be used in conjunction with :ref:`Callable <annotating-callables>` and
11661173
:class:`ParamSpec` to annotate a higher-order callable which adds, removes,
11671174
or transforms parameters of another

0 commit comments

Comments
 (0)