Skip to content

Commit bc63840

Browse files
committed
Fix an error message mismatch on windows.
1 parent 0af708d commit bc63840

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
@@ -1778,8 +1778,11 @@ def parse_file(self) -> None:
17781778
source = manager.fscache.read_with_python_encoding(path)
17791779
self.source_hash = manager.fscache.md5(path)
17801780
except IOError as ioerr:
1781+
# ioerr.strerror differs for os.stat failures between Windows and
1782+
# other systems, but os.strerror(ioerr.errno) does not, so we use that.
17811783
raise CompileError([
1782-
"mypy: can't read file '{}': {}".format(self.path, ioerr.strerror)])
1784+
"mypy: can't read file '{}': {}".format(
1785+
self.path, os.strerror(ioerr.errno))])
17831786
except (UnicodeDecodeError, DecodeError) as decodeerr:
17841787
raise CompileError([
17851788
"mypy: can't decode file '{}': {}".format(self.path, str(decodeerr))])

0 commit comments

Comments
 (0)