[issue5492] Error on leaving IDLE with quit() or exit() under Linux

Roger Serwy report at bugs.python.org
Sat Apr 20 04:10:49 CEST 2013


Roger Serwy added the comment:

Good catch Terry! I've been testing using "python -m idlelib.idle" instead of importing it from an interactive prompt. I'll need to remember to consider that test vector in the future.

I figured out why those messages are popping up. The Tk event loop remains running when in the interactive Python REPL due to a PyOS_InputHook driving the Tk loop periodically. Some .after callbacks expire and Tcl tries calling into a Python function that no longer exists. The ColorDelegator's recolorize() and PyShell's poll_subprocess() are the callbacks. (Adding a "print(name, func)" to the after() function in Lib/tkinter/__init__.py revealed the link between the Tcl reference name and the Python reference name.)

The extra ColorDelegator call is actually a bug, related to #13495. (I need to expand it that issue to include this new problem.) Two ColorDelegators get loaded, and only one gets its close() method called which properly cancels the .after callback into recolorize. The "orphaned" ColorDelegator still exists in the delegator chain with an active .after callback.

Once both those .after callbacks are canceled, then the error messages Terry sees are no longer shown.

The rev1 patch includes extra code to handle cancellation of the poll_subprocess .after callback. I'll be posting the multi-color delegator fix to #13495.

----------
dependencies: +IDLE: Regressions - Two ColorDelegator instances loaded and -e no longer edits new files.
Added file: http://bugs.python.org/file29945/issue5492_rev1.patch

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


More information about the Python-bugs-list mailing list