Skip to content

Commit

Permalink
Fix internal mypy error on Windows (#13153)
Browse files Browse the repository at this point in the history
When running `pre-commit` on Windows, I get the error below:

```
src\_pytest\_py\error.py:95: error: Invalid index type "Optional[int]" for "dict[int, int]"; expected type "int"  [index]
Found 1 error in 1 file (checked 234 source files)
```

Ignore the error because we do catch the `KeyError` anyway.
  • Loading branch information
nicoddemus authored Jan 21, 2025
1 parent 4a6a512 commit 2f1c143
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_pytest/_py/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def checked_call(
raise
if sys.platform == "win32":
try:
cls = self._geterrnoclass(_winerrnomap[value.errno])
# error: Invalid index type "Optional[int]" for "dict[int, int]"; expected type "int" [index]
# OK to ignore because we catch the KeyError below.
cls = self._geterrnoclass(_winerrnomap[value.errno]) # type:ignore[index]
except KeyError:
raise value
else:
Expand Down

0 comments on commit 2f1c143

Please sign in to comment.