Skip to content

Commit c1392c4

Browse files
committed
Merge branch 'main' into ci-multiarch-co-install
2 parents 9af8639 + 115400b commit c1392c4

189 files changed

Lines changed: 4760 additions & 1339 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.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ jobs:
339339
with:
340340
persist-credentials: false
341341
- name: Build and test
342-
run: JAVA_HOME="${JAVA_HOME_21_X64:-$JAVA_HOME_21_arm64}" python3 Platforms/Android ci --fast-ci ${{ matrix.arch }}-linux-android
342+
run: python3 Platforms/Android ci --fast-ci ${{ matrix.arch }}-linux-android
343343

344344
build-ios:
345345
name: iOS

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Tools/unicode/data/
143143
/config.status.lineno
144144
/.ccache
145145
/cross-build*/
146+
/dist/
146147
/jit_stencils*.h
147148
/jit_unwind_info*.h
148149
.jit-stamp

Doc/c-api/arg.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,18 @@ inside nested parentheses. They are:
399399
their default value --- when an optional argument is not specified,
400400
:c:func:`PyArg_ParseTuple` does not touch the contents of the corresponding C
401401
variable(s).
402+
For example, the format string ``"OO|OO"`` corresponds to the Python
403+
signature ``f(a, b, c=None, d=None)``.
402404

403405
``$``
404406
:c:func:`PyArg_ParseTupleAndKeywords` only:
405407
Indicates that the remaining arguments in the Python argument list are
406-
keyword-only. Currently, all keyword-only arguments must also be optional
407-
arguments, so ``|`` must always be specified before ``$`` in the format
408-
string.
408+
keyword-only.
409+
They are optional if ``|`` was specified before ``$``, and required otherwise.
410+
``|`` cannot be specified after ``$``.
411+
For example, the format string ``"O|O$O"`` corresponds to the Python
412+
signature ``f(a, b=None, *, c=None)``,
413+
and the format string ``"OO$OO"`` corresponds to ``f(a, b, *, c, d)``.
409414

410415
.. versionadded:: 3.3
411416

Doc/c-api/frame.rst

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -243,62 +243,3 @@ Unless using :pep:`523`, you will not need this.
243243
Return the currently executing line number, or -1 if there is no line number.
244244
245245
.. versionadded:: 3.12
246-
247-
248-
.. c:var:: const PyTypeObject *PyUnstable_ExecutableKinds
249-
250-
An array of executable kinds (executor types) for frames, used for internal
251-
debugging and tracing.
252-
253-
Tools like debuggers and profilers can use this to identify the type of execution
254-
context associated with a frame (such as to filter out internal frames).
255-
The entries are indexed by the following constants:
256-
257-
.. list-table::
258-
:header-rows: 1
259-
:widths: auto
260-
261-
* - Constant
262-
- Description
263-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_SKIP
264-
- The frame is internal (For example: inlined) and should be skipped by tools.
265-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_PY_FUNCTION
266-
- The frame corresponds to a standard Python function.
267-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION
268-
- The frame corresponds to a function defined in native code.
269-
* - .. c:macro:: PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR
270-
- The frame corresponds to a method on a class instance.
271-
272-
However, Python's C API lacks a function to read the executable kind from
273-
a frame. Instead, use this recipe:
274-
275-
.. code-block:: c
276-
277-
int
278-
get_executable_kind(PyFrameObject *frame)
279-
{
280-
_PyInterpreterFrame *f = frame->f_frame;
281-
PyObject *exec = PyStackRef_AsPyObjectBorrow(f->f_executable);
282-
283-
if (PyCode_Check(exec)) {
284-
return PyUnstable_EXECUTABLE_KIND_PY_FUNCTION;
285-
}
286-
if (PyMethod_Check(exec)) {
287-
return PyUnstable_EXECUTABLE_KIND_BUILTIN_FUNCTION;
288-
}
289-
if (Py_IS_TYPE(exec, &PyMethodDescr_Type)) {
290-
return PyUnstable_EXECUTABLE_KIND_METHOD_DESCRIPTOR;
291-
}
292-
293-
return PyUnstable_EXECUTABLE_KIND_SKIP;
294-
}
295-
296-
.. versionadded:: 3.13
297-
298-
299-
.. c:macro:: PyUnstable_EXECUTABLE_KINDS
300-
301-
The number of entries in :c:data:`PyUnstable_ExecutableKinds`.
302-
303-
.. versionadded:: 3.13
304-

Doc/deprecations/pending-removal-in-3.17.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ Pending removal in Python 3.17
3737
is deprecated and scheduled for removal in Python 3.17.
3838
(Contributed by Stan Ulbrych in :gh:`136702`.)
3939

40+
* :mod:`profile`:
41+
42+
- The :mod:`!profile` module is deprecated and will be removed in
43+
Python 3.17. Use :mod:`profiling.tracing` instead, which provides a
44+
compatible API. See :pep:`799` for details.
45+
(Contributed by Pablo Galindo and László Kiss Kollár in :gh:`138122`.)
46+
4047
* :mod:`webbrowser`:
4148

4249
- :class:`!webbrowser.MacOSXOSAScript` is deprecated in favour of

Doc/library/argparse.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,12 +1564,12 @@ it exits and prints the error along with a usage message::
15641564
>>> # invalid option
15651565
>>> parser.parse_args(['--bar'])
15661566
usage: PROG [-h] [--foo FOO] [bar]
1567-
PROG: error: no such option: --bar
1567+
PROG: error: unrecognized arguments: --bar
15681568

15691569
>>> # wrong number of arguments
15701570
>>> parser.parse_args(['spam', 'badger'])
15711571
usage: PROG [-h] [--foo FOO] [bar]
1572-
PROG: error: extra arguments found: badger
1572+
PROG: error: unrecognized arguments: badger
15731573

15741574

15751575
Arguments containing ``-``
@@ -1606,7 +1606,7 @@ there are no options in the parser that look like negative numbers::
16061606
>>> # negative number options present, so -2 is an option
16071607
>>> parser.parse_args(['-2'])
16081608
usage: PROG [-h] [-1 ONE] [foo]
1609-
PROG: error: no such option: -2
1609+
PROG: error: unrecognized arguments: -2
16101610

16111611
>>> # negative number options present, so both -1s are options
16121612
>>> parser.parse_args(['-1', '-1'])
@@ -1679,6 +1679,12 @@ The Namespace object
16791679
Simple class used by default by :meth:`~ArgumentParser.parse_args` to create
16801680
an object holding attributes and return it.
16811681

1682+
:class:`!Namespace` objects support :func:`copy.replace`,
1683+
which returns a copy of the object with the specified attributes replaced.
1684+
1685+
.. versionchanged:: next
1686+
Added support for :func:`copy.replace`.
1687+
16821688
This class is deliberately simple, just an :class:`object` subclass with a
16831689
readable string representation. If you prefer to have dict-like view of the
16841690
attributes, you can use the standard Python idiom, :func:`vars`::

Doc/library/ast.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,8 @@ Comprehensions
806806
List and set comprehensions, generator expressions, and dictionary
807807
comprehensions. ``elt`` (or ``key`` and ``value``) is a single node
808808
representing the part that will be evaluated for each item.
809-
809+
For dictionary comprehensions using unpacking, for example
810+
``{**item for item in items}``, ``value`` is ``None``,
810811
``generators`` is a list of :class:`comprehension` nodes.
811812

812813
.. doctest::

Doc/library/asyncio-eventloop.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ Creating network servers
838838
*, sock=None, backlog=100, ssl=None, \
839839
ssl_handshake_timeout=None, \
840840
ssl_shutdown_timeout=None, \
841-
start_serving=True, cleanup_socket=True)
841+
start_serving=True, cleanup_socket=True, mode=None)
842842
:async:
843843
844844
Similar to :meth:`loop.create_server` but works with the
@@ -853,6 +853,13 @@ Creating network servers
853853
be removed from the filesystem when the server is closed, unless the
854854
socket has been replaced after the server has been created.
855855

856+
If *mode* is not ``None``, the permissions of the socket file created
857+
for *path* are changed to *mode* (as accepted by :func:`os.chmod`)
858+
right after binding, before the server starts accepting connections,
859+
so a connection can never be accepted while the default,
860+
umask-derived permissions are still in effect. *mode* cannot be
861+
combined with *sock* and is not supported for abstract Unix sockets.
862+
856863
See the documentation of the :meth:`loop.create_server` method
857864
for information about arguments to this method.
858865

@@ -871,6 +878,10 @@ Creating network servers
871878

872879
Added the *cleanup_socket* parameter.
873880

881+
.. versionchanged:: 3.16
882+
883+
Added the *mode* parameter.
884+
874885

875886
.. method:: loop.connect_accepted_socket(protocol_factory, \
876887
sock, *, ssl=None, ssl_handshake_timeout=None, \

Doc/library/asyncio-stream.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ and work with streams:
171171
.. function:: start_unix_server(client_connected_cb, path=None, \
172172
*, limit=None, sock=None, backlog=100, ssl=None, \
173173
ssl_handshake_timeout=None, \
174-
ssl_shutdown_timeout=None, start_serving=True, cleanup_socket=True)
174+
ssl_shutdown_timeout=None, start_serving=True, \
175+
cleanup_socket=True, mode=None)
175176
:async:
176177
177178
Start a Unix socket server.
@@ -182,6 +183,9 @@ and work with streams:
182183
be removed from the filesystem when the server is closed, unless the
183184
socket has been replaced after the server has been created.
184185

186+
If *mode* is not ``None``, the permissions of the Unix socket file
187+
are set to *mode* before the server starts accepting connections.
188+
185189
See also the documentation of :meth:`loop.create_unix_server`.
186190

187191
.. note::
@@ -205,6 +209,9 @@ and work with streams:
205209
.. versionchanged:: 3.13
206210
Added the *cleanup_socket* parameter.
207211

212+
.. versionchanged:: 3.16
213+
Added the *mode* parameter.
214+
208215

209216
StreamReader
210217
============
@@ -382,6 +389,16 @@ StreamWriter
382389
be resumed. When there is nothing to wait for, the :meth:`drain`
383390
returns immediately.
384391

392+
.. note::
393+
394+
When the write buffer is below the high watermark,
395+
:meth:`drain` returns immediately without yielding to
396+
the event loop. As a result, code which repeatedly calls
397+
``write()`` followed by ``await drain()`` may prevent other
398+
tasks from running. To prevent blocking behavior, yield
399+
to the event loop explicitly with ``await asyncio.sleep(0)``
400+
(see :func:`asyncio.sleep`).
401+
385402
.. method:: start_tls(sslcontext, *, server_hostname=None, \
386403
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
387404
:async:

Doc/library/asyncio-task.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,17 @@ Creating tasks
288288
# completion:
289289
task.add_done_callback(background_tasks.discard)
290290

291+
Note that this approach never awaits the tasks, so if a task
292+
fails, its exception is never retrieved and asyncio logs a
293+
"Task exception was never retrieved" message when the task is
294+
garbage collected. To avoid this, use :class:`asyncio.TaskGroup`
295+
which keeps a strong reference to each task, awaits them and
296+
propagates their exceptions::
297+
298+
async with asyncio.TaskGroup() as tg:
299+
for i in range(10):
300+
tg.create_task(some_coro(param=i))
301+
291302
.. versionadded:: 3.7
292303

293304
.. versionchanged:: 3.8

0 commit comments

Comments
 (0)