https://mypy-play.net/?mypy=latest&python=3.10&flags=strict%2Cstrict-equality&gist=e86aa52c05acd36b6c04067cb6f44ce1
import sys
def main() -> int:
return sys.exit(42)
MyPy finds nothing wrong here.
Anyway, this should be valid:
try:
sys.exit(42)
except SystemExit:
print('xxx') # this line IS reachable.
i.e. this function either raises specific exception or noreturn.