Commit 1e2fcac4 authored by Terry Jan Reedy's avatar Terry Jan Reedy Committed by GitHub

bpo-32207: Improve tk event exception tracebacks in IDLE. (#4703)

When tk event handling is driven by IDLE's run loop, a confusing
and distracting queue.EMPTY traceback context is no longer added
to tk event exception tracebacks.  The traceback is now the same
as when event handling is driven by user code.  Patch based on
a suggestion by Serhiy Storchaka.
parent 21255fc3
...@@ -134,13 +134,17 @@ def main(del_exitfunc=False): ...@@ -134,13 +134,17 @@ def main(del_exitfunc=False):
# exiting but got an extra KBI? Try again! # exiting but got an extra KBI? Try again!
continue continue
try: try:
seq, request = rpc.request_queue.get(block=True, timeout=0.05) request = rpc.request_queue.get(block=True, timeout=0.05)
except queue.Empty: except queue.Empty:
handle_tk_events() request = None
continue # Issue 32207: calling handle_tk_events here adds spurious
method, args, kwargs = request # queue.Empty traceback to event handling exceptions.
if request:
seq, (method, args, kwargs) = request
ret = method(*args, **kwargs) ret = method(*args, **kwargs)
rpc.response_queue.put((seq, ret)) rpc.response_queue.put((seq, ret))
else:
handle_tk_events()
except KeyboardInterrupt: except KeyboardInterrupt:
if quitting: if quitting:
exit_now = True exit_now = True
......
Improve tk event exception tracebacks in IDLE.
When tk event handling is driven by IDLE's run loop, a confusing
and distracting queue.EMPTY traceback context is no longer added
to tk event exception tracebacks. The traceback is now the same
as when event handling is driven by user code. Patch based on a
suggestion by Serhiy Storchaka.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment