-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkinter
Description
Bug report
Bug description:
tkinter.filedialog.askopenfilename raises TypeError when filetypes=None, despite docs stating that None is acceptable.
Expected behavior:
Passing filetypes=None should behave the same as omitting the option and open the file dialog without restricting file types.
Actual behavior:
A TypeError: 'NoneType' object is not iterable exception is raised before the dialog is shown.
Root cause:
In Lib/tkinter/filedialog.py:
self.options["filetypes"] = tuple(self.options["filetypes"])
with no guard for None
Minimal example:
from tkinter import Tk, filedialog
root = Tk()
root.withdraw()
filedialog.askopenfilename(filetypes=None)Python Versions: 3.14.0rc3 and 3.14.2
OS: Windows 11
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-tkinter