Skip to content

Commit 78bf798

Browse files
Fix for Windows
1 parent 0a5da65 commit 78bf798

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mypy/report.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ def on_file(
172172
) -> None:
173173
# Count physical lines. This assumes the file's encoding is a
174174
# superset of ASCII (or at least uses \n in its line endings).
175-
try:
175+
if not os.path.isdir(tree.path): # can happen with namespace packages
176176
with open(tree.path, "rb") as f:
177177
physical_lines = len(f.readlines())
178-
except IsADirectoryError:
179-
# can happen with namespace packages
178+
else:
180179
physical_lines = 0
181180

182181
func_counter = FuncCounterVisitor()

0 commit comments

Comments
 (0)