Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 14857cf

Browse files
committed
Issue #16582: use int exit code in tkinter._exit
2 parents 50cdd55 + 806bfad commit 14857cf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Lib/tkinter/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ def _tkerror(err):
148148
"""Internal function."""
149149
pass
150150

151-
def _exit(code='0'):
151+
def _exit(code=0):
152152
"""Internal function. Calling it will throw the exception SystemExit."""
153+
try:
154+
code = int(code)
155+
except ValueError:
156+
pass
153157
raise SystemExit(code)
154158

155159
_varnum = 0

0 commit comments

Comments
 (0)