[issue20167] Exception on IDLE closing

Tal Einat report at bugs.python.org
Wed Feb 5 12:43:38 CET 2014


Tal Einat added the comment:

I put the try/except outside of the loop on purpose. If calling the widget's unbind() method fails once, it will fail forever afterwards.

If you prefer a different spelling, move the try/except into the loop, and break out of the loop in case of an exception:

for seq, id in self.handlerids:
    try:
        self.widget.unbind(self.widgetinst, seq, id)
    except _tkinter.TclError:
        break


As for avoiding the exception in the first place, I'm sure figuring out how IDLE shuts down would be a lot of work, and I honestly don't think it's necessary. Note that this problem is triggered in a __del__() method; making sure these are called at a proper time is problematic because the timing depends on the GC.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20167>
_______________________________________


More information about the Python-bugs-list mailing list