Skip to content

Commit 6250ebf

Browse files
authored
Merge branch 'python:main' into main
2 parents cd419d9 + 357c650 commit 6250ebf

183 files changed

Lines changed: 8846 additions & 4129 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: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -361,23 +361,14 @@ jobs:
361361
needs: build-context
362362
if: needs.build-context.outputs.run-ios == 'true'
363363
timeout-minutes: 60
364-
runs-on: macos-14
364+
runs-on: macos-26
365365
steps:
366366
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
367367
with:
368368
persist-credentials: false
369369

370-
# GitHub recommends explicitly selecting the desired Xcode version:
371-
# https://github.com/actions/runner-images/issues/12541#issuecomment-3083850140
372-
# This became a necessity as a result of
373-
# https://github.com/actions/runner-images/issues/12541 and
374-
# https://github.com/actions/runner-images/issues/12751.
375-
- name: Select Xcode version
376-
run: |
377-
sudo xcode-select --switch /Applications/Xcode_15.4.app
378-
379370
- name: Build and test
380-
run: python3 Platforms/Apple ci iOS --fast-ci --simulator 'iPhone SE (3rd generation),OS=17.5'
371+
run: python3 Platforms/Apple ci iOS --fast-ci
381372

382373
build-emscripten:
383374
name: 'Emscripten'
@@ -554,6 +545,7 @@ jobs:
554545
- Thread
555546
free-threading:
556547
- false
548+
- true
557549
sanitizer:
558550
- TSan
559551
include:
@@ -565,17 +557,6 @@ jobs:
565557
sanitizer: ${{ matrix.sanitizer }}
566558
free-threading: ${{ matrix.free-threading }}
567559

568-
# XXX: Temporarily allow this job to fail to not block PRs.
569-
build-san-free-threading:
570-
# ${{ '' } is a hack to nest jobs under the same sidebar category.
571-
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
572-
needs: build-context
573-
if: needs.build-context.outputs.run-ubuntu == 'true'
574-
uses: ./.github/workflows/reusable-san.yml
575-
with:
576-
sanitizer: TSan
577-
free-threading: true
578-
579560
cross-build-linux:
580561
name: Cross build Linux
581562
runs-on: ubuntu-26.04
@@ -679,7 +660,6 @@ jobs:
679660
- test-hypothesis
680661
- build-asan
681662
- build-san
682-
- build-san-free-threading
683663
- cross-build-linux
684664
- cifuzz
685665
if: always()
@@ -691,7 +671,6 @@ jobs:
691671
allowed-failures: >-
692672
build-android,
693673
build-emscripten,
694-
build-san-free-threading,
695674
build-windows-msi,
696675
build-ubuntu-ssltests,
697676
test-hypothesis,

Doc/c-api/float.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ most likely :exc:`OverflowError`).
233233
234234
Pack a C double as the IEEE 754 binary64 double precision format.
235235
236-
.. impl-detail::
237-
This function always succeeds in CPython.
238-
239236
240237
Unpack functions
241238
^^^^^^^^^^^^^^^^
@@ -251,9 +248,6 @@ Return value: The unpacked double. On error, this is ``-1.0`` and
251248
:c:func:`PyErr_Occurred` is true (and an exception is set, most likely
252249
:exc:`OverflowError`).
253250
254-
.. impl-detail::
255-
These functions always succeed in CPython.
256-
257251
.. c:function:: double PyFloat_Unpack2(const char *p, int le)
258252
259253
Unpack the IEEE 754 binary16 half-precision format as a C double.

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,11 @@ Pending removal in Python 3.19
4040
Before Python 3.14, this property was used to implement the corresponding
4141
``read()`` and ``readline()`` methods for :class:`~imaplib.IMAP4` but this
4242
is no longer the case since then.
43+
44+
* :mod:`tkinter`:
45+
46+
* :func:`tkinter.filedialog.askopenfiles` has been deprecated since Python
47+
3.16. Iterate over the names returned by
48+
:func:`~tkinter.filedialog.askopenfilenames` and open them one by one
49+
instead.
50+
(Contributed by Serhiy Storchaka in :gh:`152638`.)

Doc/library/asyncio-eventloop.rst

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,12 +1145,21 @@ convenient.
11451145

11461146
*sock* must be a non-blocking socket.
11471147

1148+
With :class:`SelectorEventLoop`, *address* does not need to be resolved:
1149+
for :const:`~socket.AF_INET` and :const:`~socket.AF_INET6` sockets,
1150+
``sock_connect`` first checks whether *address* is already resolved by
1151+
calling :func:`socket.inet_pton`, and uses :meth:`loop.getaddrinfo` to
1152+
resolve it if it is not.
1153+
1154+
:class:`ProactorEventLoop`, the default event loop on Windows, does not
1155+
resolve *address*. The host must already be a numeric IP address; passing
1156+
a host name raises :exc:`OSError`. Resolve the address with
1157+
:meth:`loop.getaddrinfo` first, or use :meth:`loop.create_connection`,
1158+
which resolves the address on every platform.
1159+
11481160
.. versionchanged:: 3.5.2
1149-
``address`` no longer needs to be resolved. ``sock_connect``
1150-
will try to check if the *address* is already resolved by calling
1151-
:func:`socket.inet_pton`. If not,
1152-
:meth:`loop.getaddrinfo` will be used to resolve the
1153-
*address*.
1161+
With :class:`SelectorEventLoop`, ``address`` no longer needs to be
1162+
resolved.
11541163

11551164
.. seealso::
11561165

@@ -1254,7 +1263,9 @@ Working with pipes
12541263
*protocol_factory* must be a callable returning an
12551264
:ref:`asyncio protocol <asyncio-protocol>` implementation.
12561265

1257-
*pipe* is a :term:`file-like object <file object>`.
1266+
*pipe* is a :term:`file-like object <file object>`. See
1267+
:ref:`Supported pipe objects <asyncio-pipe-objects>` for the objects
1268+
supported as *pipe*.
12581269

12591270
Return pair ``(transport, protocol)``, where *transport* supports
12601271
the :class:`ReadTransport` interface and *protocol* is an object
@@ -1271,7 +1282,9 @@ Working with pipes
12711282
*protocol_factory* must be a callable returning an
12721283
:ref:`asyncio protocol <asyncio-protocol>` implementation.
12731284

1274-
*pipe* is :term:`file-like object <file object>`.
1285+
*pipe* is a :term:`file-like object <file object>`. See
1286+
:ref:`Supported pipe objects <asyncio-pipe-objects>` for the objects
1287+
supported as *pipe*.
12751288

12761289
Return pair ``(transport, protocol)``, where *transport* supports
12771290
:class:`WriteTransport` interface and *protocol* is an object
@@ -1280,6 +1293,33 @@ Working with pipes
12801293
With :class:`SelectorEventLoop` event loop, the *pipe* is set to
12811294
non-blocking mode.
12821295

1296+
.. _asyncio-pipe-objects:
1297+
1298+
.. rubric:: Supported pipe objects
1299+
1300+
These methods only work with objects the operating system can poll for
1301+
readiness or perform overlapped I/O on. Regular files on disk are **not**
1302+
supported on any platform. There is no asynchronous file I/O in asyncio;
1303+
use :meth:`loop.run_in_executor` to read and write regular files without
1304+
blocking the event loop.
1305+
1306+
On Unix, with :class:`SelectorEventLoop`, *pipe* must wrap one of the
1307+
following:
1308+
1309+
* a pipe, such as an end of an :func:`os.pipe` pair or a FIFO created with
1310+
:func:`os.mkfifo`;
1311+
* a socket;
1312+
* a character device, such as a terminal.
1313+
1314+
On Windows, where only :class:`ProactorEventLoop` implements these methods,
1315+
*pipe* must wrap a handle opened for overlapped I/O (that is, created with the
1316+
``FILE_FLAG_OVERLAPPED`` flag), since the handle has to be associated with an
1317+
I/O completion port. Handles that were not opened for overlapped I/O are
1318+
rejected. In particular, the standard streams (:data:`sys.stdin`,
1319+
:data:`sys.stdout` and :data:`sys.stderr`), console handles, and the pipes
1320+
created by :func:`os.pipe` are **not** opened for overlapped I/O and therefore
1321+
cannot be used with these methods.
1322+
12831323
.. note::
12841324

12851325
:class:`SelectorEventLoop` does not support the above methods on

Doc/library/asyncio-platforms.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ All Platforms
1919
* :meth:`loop.add_reader` and :meth:`loop.add_writer`
2020
cannot be used to monitor file I/O.
2121

22+
* :meth:`loop.connect_read_pipe` and :meth:`loop.connect_write_pipe`
23+
cannot be used with regular files. See :ref:`Supported pipe objects
24+
<asyncio-pipe-objects>` for the objects that are accepted on each
25+
platform.
26+
2227

2328
Windows
2429
=======
@@ -62,6 +67,10 @@ All event loops on Windows do not support the following methods:
6267
* The :meth:`loop.add_reader` and :meth:`loop.add_writer`
6368
methods are not supported.
6469

70+
* :meth:`loop.connect_read_pipe` and :meth:`loop.connect_write_pipe` only
71+
accept a handle opened for overlapped I/O.
72+
See :ref:`Supported pipe objects <asyncio-pipe-objects>` for which objects are supported.
73+
6574
The resolution of the monotonic clock on Windows is usually around 15.6
6675
milliseconds. The best resolution is 0.5 milliseconds. The resolution depends on the
6776
hardware (availability of `HPET

Doc/library/asyncio-queue.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Queue
7171
Return an item if one is immediately available, else raise
7272
:exc:`QueueEmpty`.
7373

74+
Raises :exc:`QueueShutDown` if the queue has been shut down and is empty.
75+
7476
.. method:: join()
7577
:async:
7678

@@ -96,6 +98,8 @@ Queue
9698

9799
If no free slot is immediately available, raise :exc:`QueueFull`.
98100

101+
Raises :exc:`QueueShutDown` if the queue has been shut down.
102+
99103
.. method:: qsize()
100104

101105
Return the number of items in the queue.
@@ -188,8 +192,9 @@ Exceptions
188192

189193
.. exception:: QueueShutDown
190194

191-
Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is
192-
called on a queue which has been shut down.
195+
Exception raised when :meth:`~Queue.put`, :meth:`~Queue.put_nowait`,
196+
:meth:`~Queue.get` or :meth:`~Queue.get_nowait` is called
197+
on a queue which has been shut down.
193198

194199
.. versionadded:: 3.13
195200

Doc/library/asyncio-task.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,9 @@ Waiting primitives
924924
Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the
925925
futures when a timeout occurs.
926926

927+
If ``wait()`` is cancelled, the futures in *aws* are not cancelled
928+
and continue to run.
929+
927930
.. versionchanged:: 3.10
928931
Removed the *loop* parameter.
929932

@@ -981,6 +984,10 @@ Waiting primitives
981984
are done. This is raised by the ``async for`` loop during asynchronous
982985
iteration or by the coroutines yielded during plain iteration.
983986

987+
``as_completed()`` does not cancel the tasks running the supplied
988+
awaitables: if a timeout occurs or the iteration is cancelled, the
989+
remaining tasks continue to run.
990+
984991
.. versionchanged:: 3.10
985992
Removed the *loop* parameter.
986993

Doc/library/asyncio-tools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The following commands inspect the process identified by ``PID``:
2424
2525
The commands read the target process state without executing any code in it.
2626
They are only available on supported platforms and may require permission to
27-
inspect another process. See the :ref:`permission-requirements <permission-requirements>` for details.
27+
inspect another process. See the :ref:`permission requirements <permission-requirements>` for details.
2828

2929
.. seealso::
3030

Doc/library/codecs.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,18 @@ On Windows, ``cpXXX`` codecs are available for all code pages.
10871087
But only codecs listed in the following table are guaranteed to exist on
10881088
other platforms.
10891089

1090+
On platforms that provide the C library's :manpage:`iconv(3)` function
1091+
(such as those using the GNU C Library),
1092+
every encoding known to ``iconv`` for which Python has no built-in codec
1093+
is available as well.
1094+
Such an encoding is looked up by its ``iconv`` name (for example ``cp1133``).
1095+
Prefixing the name with ``iconv:`` forces the use of the ``iconv``-based codec
1096+
even when a built-in codec of the same name exists (for example ``iconv:latin1``),
1097+
which is mostly useful for testing.
1098+
1099+
.. versionchanged:: next
1100+
Added support for encodings provided by the C library's ``iconv``.
1101+
10901102
.. impl-detail::
10911103

10921104
Some common encodings can bypass the codecs lookup machinery to

Doc/library/dialog.rst

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,23 @@ cancelled it is the empty value documented for that function -- an empty
163163
string, an empty tuple, an empty list or ``None``.
164164

165165
.. function:: askopenfile(mode="r", **options)
166-
askopenfiles(mode="r", **options)
167166

168-
Create an :class:`Open` dialog.
169-
:func:`askopenfile` returns the opened file object, or ``None`` if the
170-
dialog is cancelled.
171-
:func:`askopenfiles` returns a list of the opened file objects, or an empty
172-
list if cancelled.
167+
Create an :class:`Open` dialog and return the opened file object,
168+
or ``None`` if the dialog is cancelled.
169+
The file is opened in mode *mode* (read-only ``'r'`` by default).
170+
171+
.. function:: askopenfiles(mode="r", **options)
172+
173+
Create an :class:`Open` dialog and return a list of the opened file objects,
174+
or an empty list if cancelled.
173175
The files are opened in mode *mode* (read-only ``'r'`` by default).
174176

177+
.. deprecated-removed:: next 3.19
178+
Opening several files at once is error-prone,
179+
and the returned list cannot be used in a :keyword:`with` statement.
180+
Iterate over the names returned by :func:`askopenfilenames`
181+
and open them one by one instead.
182+
175183
.. function:: asksaveasfile(mode="w", **options)
176184

177185
Create a :class:`SaveAs` dialog and return the opened file object, or
@@ -201,19 +209,16 @@ string, an empty tuple, an empty list or ``None``.
201209

202210
.. class:: Open(master=None, **options)
203211
SaveAs(master=None, **options)
212+
Directory(master=None, **options)
204213
205-
The above two classes provide native dialog windows for saving and loading
206-
files.
214+
The above three classes provide native dialog windows for loading and saving
215+
files and for selecting a directory.
207216

208217
**Convenience classes**
209218

210219
The below classes are used for creating file/directory windows from scratch.
211220
These do not emulate the native look-and-feel of the platform.
212221

213-
.. class:: Directory(master=None, **options)
214-
215-
Create a dialog prompting the user to select a directory.
216-
217222
.. note:: The *FileDialog* class should be subclassed for custom event
218223
handling and behaviour.
219224

@@ -353,23 +358,25 @@ the classic (non-themed) Tk widgets.
353358

354359
.. data:: DIALOG_ICON
355360

356-
The name of the default bitmap (``'questhead'``) displayed by a
357-
:class:`Dialog`.
361+
The name of a bitmap (``'questhead'``) suitable for use as the *bitmap*
362+
of a :class:`Dialog`.
358363

359364
.. class:: Dialog(master=None, cnf={}, **kw)
360365

361366
Display a modal dialog box built from the classic (non-themed) Tk widgets
362367
and wait for the user to press one of its buttons.
363-
The options, given through *cnf* or as keyword arguments, include *title*
364-
(the window title), *text* (the message), *bitmap* (an icon,
365-
:data:`DIALOG_ICON` by default), *default* (the index of the default button)
366-
and *strings* (the sequence of button labels).
368+
The options, given through *cnf* or as keyword arguments, are all required:
369+
*title* (the window title), *text* (the message), *bitmap* (the name of a
370+
bitmap icon, such as :data:`DIALOG_ICON`), *default* (the index of the
371+
default button) and *strings* (the sequence of button labels).
367372
After construction, the :attr:`!num` attribute holds the index of the button
368373
the user pressed.
369374

370375
.. method:: destroy()
371376

372-
Destroy the dialog window.
377+
Do nothing.
378+
The dialog window is destroyed automatically before the constructor
379+
returns, so there is nothing left for this method to do.
373380

374381

375382
.. seealso::

0 commit comments

Comments
 (0)