You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When tkinter get's a keyword argument, it tries to convert it to a string that tcl/tk can handle. The problem is that when a callable object is passed in as the value for a keyword argument, tkinter usually calls an internal _register method but it's missing from the Image class. Here in tkinter/__init__.py, tkinter tries to call self._register(v) but there is no method named _register in the Image class. There is a _register method for Misc and Variable but Image doesn't inherit from any of those. A minimal reproducible example:
The expected error is: _tkinter.TclError: expected integer but got "140140827421696print" but it's throwing AttributeError: 'PhotoImage' object has no attribute '_register'.
The only time this bug would appear is when someone makes a mistake and calls PhotoImage or BitmapImage with a callable keyword parameter. So the only difference is the error message.
Your environment
The issue isn't environment dependant.
CPython versions tested on: 3.10 but from the source code, it should be present in all 3.7+ versions of cpython.
Activity
pythongh-100814: Fix exception for invalidi callable value of Tkinter…
gh-100814: Fix exception for invalid callable value of Tkinter image …
pythongh-100814: Fix exception for invalid callable value of Tkinter …
pythongh-100814: Fix exception for invalid callable value of Tkinter …
[3.11] gh-100814: Fix exception for invalid callable value of Tkinter…
[3.12] gh-100814: Fix exception for invalid callable value of Tkinter…