Skip to content

Commit 365bdc5

Browse files
ambvgvanrossum
authored andcommitted
Only catch SystemExit in api.run() (#2633)
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.).
1 parent c6bae48 commit 365bdc5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(params: str) -> Tuple[str, str]:
4747

4848
try:
4949
main(None)
50-
except:
50+
except SystemExit:
5151
pass
5252

5353
sys.stdout = old_stdout

0 commit comments

Comments
 (0)