-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Description
The Python documentation says:
https://docs.python.org/3/library/sys.html#sys.exit
sys.exit([arg])
[...]
The optional argument arg can be an integer giving the exit status (defaulting to zero),
or another type of object. [...] If another type of object is passed, None is equivalent to
passing zero, and any other object is printed to stderr and results in an exit code of 1.
For example:
import sys
sys.exit(RuntimeError('oops'))
(which more commonly would be try...except RuntimeError as exc: [...]; sys.exit(exc)
)
Output for mypy 1.18.2:
/tmp/test.py:3: error: Argument 1 to "exit" has incompatible type "RuntimeError"; expected "str | int | None" [arg-type]
mypy only accepts str | int | None
, as a result of issue #8513.
But, since this is valid Python code, I feel that mypy should accept it.
Metadata
Metadata
Assignees
Labels
No labels