Skip to content

Commit 611bdaa

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix-issue-46375
2 parents bb6447d + 0db2517 commit 611bdaa

File tree

203 files changed

+3925
-2758
lines changed

Some content is hidden

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

203 files changed

+3925
-2758
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/c-api/unicode.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,8 @@ These are the UTF-8 codec APIs:
971971
returned buffer always has an extra null byte appended (not included in
972972
*size*), regardless of whether there are any other null code points.
973973
974-
In the case of an error, ``NULL`` is returned with an exception set and no
975-
*size* is stored.
974+
On error, set an exception, set *size* to ``-1`` (if it's not NULL) and
975+
return ``NULL``.
976976
977977
This caches the UTF-8 representation of the string in the Unicode object, and
978978
subsequent calls will return a pointer to the same buffer. The caller is not
@@ -992,11 +992,19 @@ These are the UTF-8 codec APIs:
992992
993993
As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size.
994994
995+
Raise an exception if the *unicode* string contains embedded null
996+
characters. To accept embedded null characters and truncate on purpose
997+
at the first null byte, ``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be
998+
used instead.
999+
9951000
.. versionadded:: 3.3
9961001
9971002
.. versionchanged:: 3.7
9981003
The return type is now ``const char *`` rather of ``char *``.
9991004
1005+
.. versionchanged:: 3.13
1006+
Raise an exception if the string contains embedded null characters.
1007+
10001008
10011009
UTF-32 Codecs
10021010
"""""""""""""

Doc/data/stable_abi.dat

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/howto/regex.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ You can omit either *m* or *n*; in that case, a reasonable value is assumed for
245245
the missing value. Omitting *m* is interpreted as a lower limit of 0, while
246246
omitting *n* results in an upper bound of infinity.
247247

248+
The simplest case ``{m}`` matches the preceding item exactly *m* times.
249+
For example, ``a/{2}b`` will only match ``'a//b'``.
250+
248251
Readers of a reductionist bent may notice that the three other quantifiers can
249252
all be expressed using this notation. ``{0,}`` is the same as ``*``, ``{1,}``
250253
is equivalent to ``+``, and ``{0,1}`` is the same as ``?``. It's better to use

Doc/library/asyncio-eventloop.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ Scheduling callbacks
243243
See the :ref:`concurrency and multithreading <asyncio-multithreading>`
244244
section of the documentation.
245245

246-
.. versionchanged:: 3.7
247-
The *context* keyword-only parameter was added. See :pep:`567`
248-
for more details.
246+
.. versionchanged:: 3.7
247+
The *context* keyword-only parameter was added. See :pep:`567`
248+
for more details.
249249

250250
.. _asyncio-pass-keywords:
251251

@@ -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.
@@ -1391,6 +1395,14 @@ Enabling debug mode
13911395
The new :ref:`Python Development Mode <devmode>` can now also be used
13921396
to enable the debug mode.
13931397

1398+
.. attribute:: loop.slow_callback_duration
1399+
1400+
This attribute can be used to set the
1401+
minimum execution duration in seconds that is considered "slow".
1402+
When debug mode is enabled, "slow" callbacks are logged.
1403+
1404+
Default value is 100 milliseconds.
1405+
13941406
.. seealso::
13951407

13961408
The :ref:`debug mode of asyncio <asyncio-debug-mode>`.
@@ -1411,6 +1423,8 @@ async/await code consider using the high-level
14111423
:ref:`Subprocess Support on Windows <asyncio-windows-subprocess>` for
14121424
details.
14131425

1426+
.. _loop_subprocess_exec:
1427+
14141428
.. coroutinemethod:: loop.subprocess_exec(protocol_factory, *args, \
14151429
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
14161430
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)

0 commit comments

Comments
 (0)