diff --git a/src/_pytest/_py/error.py b/src/_pytest/_py/error.py index 1c7984f5a8f..dace23764ff 100644 --- a/src/_pytest/_py/error.py +++ b/src/_pytest/_py/error.py @@ -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: