Skip to content

Commit

Permalink
Check that errno is not None (#18084)
Browse files Browse the repository at this point in the history
Unblocks typeshed sync
  • Loading branch information
hauntsaninja authored Nov 1, 2024
1 parent b59878e commit 46595ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,7 @@ def parse_file(self, *, temporary: bool = False) -> None:
# other systems, but os.strerror(ioerr.errno) does not, so we use that.
# (We want the error messages to be platform-independent so that the
# tests have predictable output.)
assert ioerr.errno is not None
raise CompileError(
[
"mypy: can't read file '{}': {}".format(
Expand Down
1 change: 1 addition & 0 deletions mypy/modulefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ def get_search_dirs(python_executable: str | None) -> tuple[list[str], list[str]
print(err.stdout)
raise
except OSError as err:
assert err.errno is not None
reason = os.strerror(err.errno)
raise CompileError(
[f"mypy: Invalid python executable '{python_executable}': {reason}"]
Expand Down

0 comments on commit 46595ee

Please sign in to comment.