Skip to content

gh-152638: Deprecate tkinter.filedialog.askopenfiles()#152647

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:gh-152638-deprecate-askopenfiles
Jul 11, 2026
Merged

gh-152638: Deprecate tkinter.filedialog.askopenfiles()#152647
serhiy-storchaka merged 4 commits into
python:mainfrom
serhiy-storchaka:gh-152638-deprecate-askopenfiles

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

Opening several files at once is error-prone, and the returned list cannot be used in a with statement: if opening one of the files fails, the files already opened are leaked; correct cleanup on error is awkward; and the number of open file descriptors is limited.

Iterate over the names returned by askopenfilenames() and open them one by one instead.

The single-file askopenfile()/asksaveasfile() are not affected.

Opening several files at once is error-prone, and the returned list
cannot be used in a "with" statement.  Iterate over the names returned
by askopenfilenames() and open them one by one instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka and others added 2 commits July 6, 2026 02:00
Deprecating in 3.16 and removing in 3.19 gives three feature releases of
deprecation before removal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@read-the-docs-community

read-the-docs-community Bot commented Jul 11, 2026

Copy link
Copy Markdown

Import warnings inside askopenfiles() rather than at module level, since
it is only used by the deprecation there.  Break the new documentation
lines at sentence and clause boundaries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) July 11, 2026 05:23
@serhiy-storchaka serhiy-storchaka merged commit f212f21 into python:main Jul 11, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant