Update comments for operator.itemgetter.__call__ generic following mypy 1.11 fix (#13489)

This commit is contained in:
Avasam
2025-10-08 04:51:14 -04:00
committed by GitHub
parent 751525bc74
commit cffeff0b61
4 changed files with 44 additions and 4 deletions
+4 -2
View File
@@ -205,8 +205,10 @@ class itemgetter(Generic[_T_co]):
# "tuple[int, int]" is incompatible with protocol "SupportsIndex"
# preventing [_T_co, ...] instead of [Any, ...]
#
# A suspected mypy issue prevents using [..., _T] instead of [..., Any] here.
# https://github.com/python/mypy/issues/14032
# If we can't infer a literal key from __new__ (ie: `itemgetter[Literal[0]]` for `itemgetter(0)`),
# then we can't annotate __call__'s return type or it'll break on tuples
#
# These issues are best demonstrated by the `itertools.check_itertools_recipes.unique_justseen` test.
def __call__(self, obj: SupportsGetItem[Any, Any]) -> Any: ...
@final