Skip to content

Commit 32c5595

Browse files
Merge branch 'main' into kristjan/asyncgen-test
2 parents 9ffc96d + 9da98c0 commit 32c5595

File tree

87 files changed

+2357
-1717
lines changed

Some content is hidden

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

87 files changed

+2357
-1717
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.1.0
3+
rev: v0.1.2
44
hooks:
55
- id: ruff
66
name: Run Ruff on Lib/test/

Doc/c-api/call.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ This is a pointer to a function with the following signature:
108108
Doing so will allow callables such as bound methods to make their onward
109109
calls (which include a prepended *self* argument) very efficiently.
110110

111+
.. versionadded:: 3.8
112+
111113
To call an object that implements vectorcall, use a :ref:`call API <capi-call>`
112114
function as with any other callable.
113115
:c:func:`PyObject_Vectorcall` will usually be most efficient.

Doc/library/asyncio-eventloop.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ Opening network connections
661661
Creating network servers
662662
^^^^^^^^^^^^^^^^^^^^^^^^
663663

664+
.. _loop_create_server:
665+
664666
.. coroutinemethod:: loop.create_server(protocol_factory, \
665667
host=None, port=None, *, \
666668
family=socket.AF_UNSPEC, \
@@ -1191,6 +1193,8 @@ Working with pipes
11911193
Unix signals
11921194
^^^^^^^^^^^^
11931195

1196+
.. _loop_add_signal_handler:
1197+
11941198
.. method:: loop.add_signal_handler(signum, callback, *args)
11951199

11961200
Set *callback* as the handler for the *signum* signal.
@@ -1419,6 +1423,8 @@ async/await code consider using the high-level
14191423
:ref:`Subprocess Support on Windows <asyncio-windows-subprocess>` for
14201424
details.
14211425

1426+
.. _loop_subprocess_exec:
1427+
14221428
.. coroutinemethod:: loop.subprocess_exec(protocol_factory, *args, \
14231429
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
14241430
stderr=subprocess.PIPE, **kwargs)

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ Shielding From Cancellation
592592

593593
is equivalent to::
594594

595-
res = await shield(something())
595+
res = await something()
596596

597597
*except* that if the coroutine containing it is cancelled, the
598598
Task running in ``something()`` is not cancelled. From the point

Doc/library/asyncio.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Additionally, there are **low-level** APIs for
4646
*library and framework developers* to:
4747

4848
* create and manage :ref:`event loops <asyncio-event-loop>`, which
49-
provide asynchronous APIs for :meth:`networking <loop.create_server>`,
50-
running :meth:`subprocesses <loop.subprocess_exec>`,
51-
handling :meth:`OS signals <loop.add_signal_handler>`, etc;
49+
provide asynchronous APIs for :ref:`networking <loop_create_server>`,
50+
running :ref:`subprocesses <loop_subprocess_exec>`,
51+
handling :ref:`OS signals <loop_add_signal_handler>`, etc;
5252

5353
* implement efficient protocols using
5454
:ref:`transports <asyncio-transports-protocols>`;

Doc/library/bz2.rst

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ The :mod:`bz2` module contains:
9191
and :meth:`~io.IOBase.truncate`.
9292
Iteration and the :keyword:`with` statement are supported.
9393

94-
:class:`BZ2File` also provides the following method:
94+
:class:`BZ2File` also provides the following methods:
9595

9696
.. method:: peek([n])
9797

@@ -106,14 +106,52 @@ The :mod:`bz2` module contains:
106106

107107
.. versionadded:: 3.3
108108

109+
.. method:: fileno()
110+
111+
Return the file descriptor for the underlying file.
112+
113+
.. versionadded:: 3.3
114+
115+
.. method:: readable()
116+
117+
Return whether the file was opened for reading.
118+
119+
.. versionadded:: 3.3
120+
121+
.. method:: seekable()
122+
123+
Return whether the file supports seeking.
124+
125+
.. versionadded:: 3.3
126+
127+
.. method:: writable()
128+
129+
Return whether the file was opened for writing.
130+
131+
.. versionadded:: 3.3
132+
133+
.. method:: read1(size=-1)
134+
135+
Read up to *size* uncompressed bytes, while trying to avoid
136+
making multiple reads from the underlying stream. Reads up to a
137+
buffer's worth of data if size is negative.
138+
139+
Returns ``b''`` if the file is at EOF.
140+
141+
.. versionadded:: 3.3
142+
143+
.. method:: readinto(b)
144+
145+
Read bytes into *b*.
146+
147+
Returns the number of bytes read (0 for EOF).
148+
149+
.. versionadded:: 3.3
150+
109151

110152
.. versionchanged:: 3.1
111153
Support for the :keyword:`with` statement was added.
112154

113-
.. versionchanged:: 3.3
114-
The :meth:`fileno`, :meth:`readable`, :meth:`seekable`, :meth:`writable`,
115-
:meth:`read1` and :meth:`readinto` methods were added.
116-
117155
.. versionchanged:: 3.3
118156
Support was added for *filename* being a :term:`file object` instead of an
119157
actual filename.

Doc/library/enum.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,12 @@ Data Types
198198
>>> some_var = Color.RED
199199
>>> some_var in Color
200200
True
201+
>>> Color.RED.value in Color
202+
True
201203

202-
.. note::
204+
.. versionchanged:: 3.12
203205

204-
In Python 3.12 it will be possible to check for member values and not
205-
just members; until then, a ``TypeError`` will be raised if a
206+
Before Python 3.12, a ``TypeError`` is raised if a
206207
non-Enum-member is used in a containment check.
207208

208209
.. method:: EnumType.__dir__(cls)

Doc/library/mmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ the current file position, and :meth:`seek` through the file to different positi
1919
A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is
2020
different on Unix and on Windows. In either case you must provide a file
2121
descriptor for a file opened for update. If you wish to map an existing Python
22-
file object, use its :meth:`fileno` method to obtain the correct value for the
22+
file object, use its :meth:`~io.IOBase.fileno` method to obtain the correct value for the
2323
*fileno* parameter. Otherwise, you can open the file using the
2424
:func:`os.open` function, which returns a file descriptor directly (the file
2525
still needs to be closed when done).

Doc/library/multiprocessing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,7 @@ multiple connections at the same time.
25822582
**Windows**: An item in *object_list* must either be an integer
25832583
handle which is waitable (according to the definition used by the
25842584
documentation of the Win32 function ``WaitForMultipleObjects()``)
2585-
or it can be an object with a :meth:`fileno` method which returns a
2585+
or it can be an object with a :meth:`~io.IOBase.fileno` method which returns a
25862586
socket handle or pipe handle. (Note that pipe handles and socket
25872587
handles are **not** waitable handles.)
25882588

Doc/library/selectors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It defines a :class:`BaseSelector` abstract base class, along with several
2121
concrete implementations (:class:`KqueueSelector`, :class:`EpollSelector`...),
2222
that can be used to wait for I/O readiness notification on multiple file
2323
objects. In the following, "file object" refers to any object with a
24-
:meth:`fileno()` method, or a raw file descriptor. See :term:`file object`.
24+
:meth:`~io.IOBase.fileno` method, or a raw file descriptor. See :term:`file object`.
2525

2626
:class:`DefaultSelector` is an alias to the most efficient implementation
2727
available on the current platform: this should be the default choice for most

0 commit comments

Comments
 (0)