]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-103878: Return a consistent empty value from cancelled file dialogs (GH-152435)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 29 Jun 2026 20:49:19 +0000 (23:49 +0300)
committerGitHub <noreply@github.com>
Mon, 29 Jun 2026 20:49:19 +0000 (20:49 +0000)
commitedcc07d985c41523ee8386d8c8880e10d0990db9
treef69e0bd63be2c818d7e7909559dd7ea0f779e09c
parent0a29d8408cfdd9a66f2b65745a3ae1cda022775c
gh-103878: Return a consistent empty value from cancelled file dialogs (GH-152435)

On cancellation Tcl may report the empty result as '', () or b'' depending
on the platform and Tk version. Normalize it so that askopenfilename(),
asksaveasfilename() and askdirectory() always return '' and
askopenfilenames() always returns ().

Open._fixresult() now distinguishes single from multiple results by the
'multiple' option rather than the result type.

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Doc/library/dialog.rst
Lib/test/test_tkinter/test_filedialog.py
Lib/tkinter/filedialog.py
Misc/NEWS.d/next/Library/2026-06-27-19-02-17.gh-issue-103878.216fa7.rst [new file with mode: 0644]