Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix internal mypy error on Windows
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 committed Jan 21, 2025
commit e7f45dd716317bcf93b0697094dd5b7d88a848ed
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
Loading