Tal Einat <talei...@gmail.com> added the comment:

Tkinter calls Tcl_DeleteInterp when a Tk object is garbage collected, and it 
registers a cleanup callback for each registered command, which according to 
the Tcl docs should be called upon Tcl_DeleteInterp[1]. So this must either be 
a bug in Tcl or something in the circumstances isn't giving it a chance to 
clean up the commands.

It's worth noting that Tk.destroy() calls Misc.destroy() which explicitly calls 
deletecommand for all registered commands. So calling .destroy() when done with 
a Tk instance, which is good practice in general, will also avoid this issue.

Considering the above, I'm not sure this is worth investigating and 
addressing...

A simple solution could be to add __del__ to Tk or Misc and have that also 
clean up any registered commands.

----------
nosy: +taleinat

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36756>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to