From 20ee7ed64d8cc8e3d2f4064ddf102af10a4afc7d Mon Sep 17 00:00:00 2001 From: Lukasz Langa Date: Tue, 3 Jan 2017 12:52:51 -0800 Subject: [PATCH] Only catch SystemExit in api.run() mypy.main.main() calls `sys.exit(1)` in case of errors. We don't want this to bubble up during API usage. Other exceptions raised from `mypy.main.main()` shouldn't be swallowed as they point out at internal errors or environment errors (no memory, interrupts, etc.). --- mypy/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mypy/api.py b/mypy/api.py index b6e2a54f21ae..80f8d93709c6 100644 --- a/mypy/api.py +++ b/mypy/api.py @@ -47,7 +47,7 @@ def run(params: str) -> Tuple[str, str]: try: main(None) - except: + except SystemExit: pass sys.stdout = old_stdout