https://github.com/python/cpython/commit/93c71c7a980007f7e4f645832311ad20e9943503
commit: 93c71c7a980007f7e4f645832311ad20e9943503
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-06-29T20:03:01Z
summary:

[3.15] gh-103878: Document that the cancelled file dialog value is only falsy 
(GH-152429) (GH-152629)

Its exact type (empty string, tuple, list or None) varies between
platforms and Tk versions, so advise testing the result for truth.
(cherry picked from commit 9dd3340a623093b5d0ff054d5d42c370bb09221c)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>

files:
M Doc/library/dialog.rst

diff --git a/Doc/library/dialog.rst b/Doc/library/dialog.rst
index 402cfcfe75369f..384a1eacc2d7cc 100644
--- a/Doc/library/dialog.rst
+++ b/Doc/library/dialog.rst
@@ -131,7 +131,10 @@ listed below:
 The below functions when called create a modal, native look-and-feel dialog,
 wait for the user's selection, and return it.
 The exact return value depends on the function (see below); when the dialog is
-cancelled it is an empty string, an empty tuple, an empty list or ``None``.
+cancelled it is an empty string, an empty tuple or ``None``.
+The precise type of this empty value may vary between platforms and Tk
+versions, so test the result for truth rather than comparing it with a
+specific value.
 
 .. function:: askopenfile(mode="r", **options)
               askopenfiles(mode="r", **options)
@@ -140,7 +143,7 @@ cancelled it is an empty string, an empty tuple, an empty 
list or ``None``.
    :func:`askopenfile` returns the opened file object, or ``None`` if the
    dialog is cancelled.
    :func:`askopenfiles` returns a list of the opened file objects, or an empty
-   list if cancelled.
+   tuple if cancelled.
    The files are opened in mode *mode* (read-only ``'r'`` by default).
 
 .. function:: asksaveasfile(mode="w", **options)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to