[New-bugs-announce] [issue16583] Tkinter nested SystemExit

Abraham Karplus report at bugs.python.org
Fri Nov 30 19:14:43 CET 2012

New submission from Abraham Karplus:

When a callback function gets called from Tkinter and raises SystemExit (either directly or through sys.exit), a new SystemExit exception is raised with the original exception as its code field, such as
This is due to a bug in Tkinter's CallWrapper, where it has
except SystemExit as msg:
    raise SystemExit(msg)
which since msg is a SystemExit instance, creates the nesting. This bug did not exist in Python 2 because there the code was
except SystemExit, msg:
    raise SystemExit, msg
and this raises msg, as it already is a SystemExit instance. I suspect the bug was introduced by using the 2to3 tool, as it will do the conversion. If so, this is a bug in 2to3, as the two snippets are not functionally identical.

components: Tkinter
messages: 176698
nosy: Abraham Karplus
priority: normal
severity: normal
status: open
title: Tkinter nested SystemExit
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list