Skip to content

Commit 6e251ea

Browse files
authored
Merge branch 'main' into list-int-compact-guard-main
2 parents 410e297 + 0023d5b commit 6e251ea

97 files changed

Lines changed: 3885 additions & 1838 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.

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

Doc/library/imaplib.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,13 @@ An :class:`IMAP4` instance has the following methods:
610610
If *uid* is true, the message numbers in the response are UIDs
611611
(``UID SEARCH``).
612612

613+
A criterion passed as :class:`str` is encoded to *charset*
614+
(which must name a codec known to Python);
615+
pass :class:`bytes` to send a criterion that is already encoded,
616+
for example when *charset* is one that Python does not support.
617+
When *charset* is ``None`` (as it must be under ``UTF8=ACCEPT``),
618+
the criterion is sent using the connection's encoding instead.
619+
613620
Example::
614621

615622
# M is a connected IMAP4 instance...
@@ -621,6 +628,9 @@ An :class:`IMAP4` instance has the following methods:
621628
.. versionchanged:: next
622629
Added the *uid* parameter.
623630

631+
.. versionchanged:: next
632+
``str`` search criteria are encoded to *charset*.
633+
624634

625635
.. method:: IMAP4.select(mailbox='INBOX', readonly=False)
626636

@@ -682,11 +692,18 @@ An :class:`IMAP4` instance has the following methods:
682692

683693
If *uid* is true, the message numbers in the response are UIDs (``UID SORT``).
684694

695+
As with :meth:`search`,
696+
a *search_criterion* passed as :class:`str` is encoded to *charset*;
697+
pass :class:`bytes` to send one already encoded.
698+
685699
This is an ``IMAP4rev1`` extension command.
686700

687701
.. versionchanged:: next
688702
Added the *uid* parameter.
689703

704+
.. versionchanged:: next
705+
``str`` search criteria are encoded to *charset*.
706+
690707

691708
.. method:: IMAP4.starttls(ssl_context=None)
692709

@@ -772,11 +789,18 @@ An :class:`IMAP4` instance has the following methods:
772789
If *uid* is true, the message numbers in the response are UIDs
773790
(``UID THREAD``).
774791

792+
As with :meth:`search`,
793+
a *search_criterion* passed as :class:`str` is encoded to *charset*;
794+
pass :class:`bytes` to send one already encoded.
795+
775796
This is an ``IMAP4rev1`` extension command.
776797

777798
.. versionchanged:: next
778799
Added the *uid* parameter.
779800

801+
.. versionchanged:: next
802+
``str`` search criteria are encoded to *charset*.
803+
780804

781805
.. method:: IMAP4.uid(command, arg[, ...])
782806

Doc/library/tk.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ alternative `GUI frameworks and tools <https://wiki.python.org/moin/GuiProgrammi
3333
tkinter.rst
3434
tkinter.colorchooser.rst
3535
tkinter.font.rst
36+
tkinter.fontchooser.rst
3637
dialog.rst
3738
tkinter.messagebox.rst
3839
tkinter.scrolledtext.rst
40+
tkinter.systray.rst
3941
tkinter.dnd.rst
4042
tkinter.ttk.rst
4143
idle.rst
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
:mod:`!tkinter.fontchooser` --- Font selection dialog
2+
=====================================================
3+
4+
.. module:: tkinter.fontchooser
5+
:synopsis: Font selection dialog
6+
7+
.. versionadded:: next
8+
9+
**Source code:** :source:`Lib/tkinter/fontchooser.py`
10+
11+
--------------
12+
13+
The :mod:`!tkinter.fontchooser` module provides the :class:`FontChooser` class
14+
as an interface to the native font selection dialog.
15+
16+
The font dialog is application-global:
17+
there is a single font dialog per Tcl interpreter,
18+
and all :class:`FontChooser` instances configure the same dialog.
19+
20+
Depending on the platform, the dialog may be modal or modeless,
21+
so :meth:`~FontChooser.show` may return immediately.
22+
The selected font is not returned:
23+
it is passed as a :class:`~tkinter.font.Font` object to the callback
24+
specified with the *command* option.
25+
26+
The dialog also generates two virtual events on the parent window
27+
(see the *parent* option):
28+
29+
``<<TkFontchooserVisibility>>``
30+
Generated when the dialog is shown or hidden.
31+
Query the *visible* option to tell which.
32+
33+
``<<TkFontchooserFontChanged>>``
34+
Generated when the selected font changes.
35+
36+
.. note::
37+
38+
The *command* callback is the only reliable way to obtain the selected font.
39+
On some platforms the *font* option is not updated to the user's choice.
40+
41+
.. class:: FontChooser(master=None, **options)
42+
43+
The class implementing the font selection dialog.
44+
45+
*master* is the widget whose Tcl interpreter owns the dialog.
46+
If omitted, it defaults to *parent* if that is given,
47+
or to the default root window otherwise.
48+
49+
The supported configuration options are:
50+
51+
* *parent* --- the window to which the dialog and its virtual events are related.
52+
It defaults to the main window;
53+
on macOS the dialog is shown as a sheet attached to it,
54+
rather than as a free-standing panel.
55+
* *title* --- the title of the dialog.
56+
* *font* --- the font that is currently selected in the dialog.
57+
* *command* --- a callback that is called
58+
with a :class:`~tkinter.font.Font` object wrapping the selected font
59+
when the user selects a font.
60+
* *visible* --- whether the dialog is currently displayed (read-only).
61+
62+
The *font* option accepts the forms supported by :class:`tkinter.font.Font`.
63+
64+
.. method:: configure(**options)
65+
config(**options)
66+
67+
Query or modify the options of the font dialog.
68+
With no arguments, return a dict of all option values.
69+
With a string argument, return the value of that option.
70+
Otherwise, set the given options.
71+
72+
.. method:: cget(option)
73+
74+
Return the value of the given option of the font dialog.
75+
76+
.. method:: show()
77+
78+
Display the font dialog.
79+
Depending on the platform, this method may return immediately
80+
or only once the dialog has been withdrawn.
81+
82+
.. method:: hide()
83+
84+
Hide the font dialog if it is displayed.
85+
86+
87+
.. seealso::
88+
89+
Module :mod:`tkinter.font`
90+
Tkinter font-handling utilities

Doc/library/tkinter.messagebox.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ a variety of convenience methods for commonly used configurations.
1313
The message boxes are modal: each blocks until the user responds, then returns
1414
a value that depends on the function.
1515
The ``show*`` functions and :meth:`Message.show` return the symbolic name of
16-
the button the user pressed, as a string (such as :data:`OK` or :data:`YES`),
17-
while the ``ask*`` functions return a :class:`bool` or ``None`` (see each
18-
function below).
16+
the button the user pressed, as a string (such as :data:`OK` or :data:`YES`).
1917
Common message box styles and layouts include but are not limited to:
2018

2119
.. figure:: tk_msg.png

0 commit comments

Comments
 (0)