From 806bfad45749f25f9d6ac1622598d348297e127b Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Mon, 10 Dec 2012 00:02:31 +0200 Subject: [PATCH] Issue #16582: use int exit code in tkinter._exit --- Lib/tkinter/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index 67a2f9a327f..70736623a18 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -146,8 +146,12 @@ def _tkerror(err): """Internal function.""" pass -def _exit(code='0'): +def _exit(code=0): """Internal function. Calling it will throw the exception SystemExit.""" + try: + code = int(code) + except ValueError: + pass raise SystemExit(code) _varnum = 0