Skip to content

Commit e0180e2

Browse files
authored
Merge branch 'main' into docs/refwarn/whatsnew-3.4
2 parents 2cad600 + 984d928 commit e0180e2

Some content is hidden

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

41 files changed

+581
-439
lines changed

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/howto/instrumentation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ should instead read:
269269
(assuming a :ref:`debug build <debug-build>` of CPython 3.6)
270270

271271

272+
.. _static-markers:
273+
272274
Available static markers
273275
------------------------
274276

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/hmac.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ cannot be used with HMAC.
5050
.. versionadded:: 3.7
5151

5252

53-
An HMAC object has the following methods:
53+
.. class:: HMAC
54+
55+
An HMAC object has the following methods:
5456

5557
.. method:: HMAC.update(msg)
5658

Doc/library/mmap.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ update the underlying file.
4848

4949
To map anonymous memory, -1 should be passed as the fileno along with the length.
5050

51-
.. class:: mmap(fileno, length, tagname=None, access=ACCESS_DEFAULT, offset=0)
51+
.. class:: mmap(fileno, length, tagname=None, \
52+
access=ACCESS_DEFAULT, offset=0, *, trackfd=True)
5253
5354
**(Windows version)** Maps *length* bytes from the file specified by the
54-
file handle *fileno*, and creates a mmap object. If *length* is larger
55+
file descriptor *fileno*, and creates a mmap object. If *length* is larger
5556
than the current size of the file, the file is extended to contain *length*
5657
bytes. If *length* is ``0``, the maximum length of the map is the current
5758
size of the file, except that if the file is empty Windows raises an
@@ -69,6 +70,17 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
6970
will be relative to the offset from the beginning of the file. *offset*
7071
defaults to 0. *offset* must be a multiple of the :const:`ALLOCATIONGRANULARITY`.
7172

73+
If *trackfd* is ``False``, the file handle corresponding to *fileno* will
74+
not be duplicated, and the resulting :class:`!mmap` object will not
75+
be associated with the map's underlying file.
76+
This means that the :meth:`~mmap.mmap.size` and :meth:`~mmap.mmap.resize`
77+
methods will fail.
78+
This mode is useful to limit the number of open file handles.
79+
The original file can be renamed (but not deleted) after closing *fileno*.
80+
81+
.. versionchanged:: next
82+
The *trackfd* parameter was added.
83+
7284
.. audit-event:: mmap.__new__ fileno,length,access,offset mmap.mmap
7385

7486
.. class:: mmap(fileno, length, flags=MAP_SHARED, prot=PROT_WRITE|PROT_READ, \

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/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

Doc/library/unittest.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,10 @@ instead of as an error.
25322532
setUpModule and tearDownModule
25332533
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25342534

2535+
.. function:: setUpModule
2536+
tearDownModule
2537+
:no-typesetting:
2538+
25352539
These should be implemented as functions::
25362540

25372541
def setUpModule():

0 commit comments

Comments
 (0)