Skip to content

Commit 11094ee

Browse files
committed
Fix an error message mismatch on windows.
1 parent 788c8c5 commit 11094ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/build.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,8 +1796,11 @@ def parse_file(self) -> None:
17961796
source = manager.fscache.read_with_python_encoding(path)
17971797
self.source_hash = manager.fscache.md5(path)
17981798
except IOError as ioerr:
1799+
# ioerr.strerror differs for os.stat failures between Windows and
1800+
# other systems, but os.strerror(ioerr.errno) does not, so we use that.
17991801
raise CompileError([
1800-
"mypy: can't read file '{}': {}".format(self.path, ioerr.strerror)])
1802+
"mypy: can't read file '{}': {}".format(
1803+
self.path, os.strerror(ioerr.errno))])
18011804
except (UnicodeDecodeError, DecodeError) as decodeerr:
18021805
raise CompileError([
18031806
"mypy: can't decode file '{}': {}".format(self.path, str(decodeerr))])

0 commit comments

Comments
 (0)