Skip to content

Commit 7f824fe

Browse files
authored
Fix #15617
1 parent c94d18a commit 7f824fe

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

stdlib/_operator.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ from _typeshed import (
1515
)
1616
from collections.abc import Callable, Container, Iterable, MutableMapping, MutableSequence, Sequence
1717
from operator import attrgetter as attrgetter, itemgetter as itemgetter, methodcaller as methodcaller
18-
from typing import Any, AnyStr, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
18+
from typing import Any, Protocol, SupportsAbs, SupportsIndex, TypeVar, overload, type_check_only
1919
from typing_extensions import ParamSpec, TypeAlias, TypeIs
2020

2121
_R = TypeVar("_R")
@@ -280,7 +280,16 @@ def ixor(a: _SupportsIXOr[_T_contra, _T_co], b: _T_contra, /) -> _T_co: ...
280280
if sys.version_info >= (3, 11):
281281
def call(obj: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
282282

283-
def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...
283+
if sys.version_info >= (3, 12):
284+
from collections.abc import Buffer
285+
_B = TypeVar("_B", bound=Buffer)
286+
@overload
287+
def _compare_digest(a: str, b: str, /) -> bool: ...
288+
@overload
289+
def _compare_digest(a: _B, b: _B, /) -> bool: ...
290+
else:
291+
from typing import AnyStr
292+
def _compare_digest(a: AnyStr, b: AnyStr, /) -> bool: ...
284293

285294
if sys.version_info >= (3, 14):
286295
def is_none(a: object, /) -> TypeIs[None]: ...

0 commit comments

Comments
 (0)