diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 5f2563a34789..777508798858 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -366,7 +366,6 @@ functools.__all__ functools.Placeholder functools.WRAPPER_ASSIGNMENTS functools.partialmethod.__new__ -functools.reduce functools.update_wrapper functools.wraps gzip.GzipFile.readinto diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index d35c295754e5..7ae916fee9d5 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -31,8 +31,14 @@ _RWrapped = TypeVar("_RWrapped") _PWrapper = ParamSpec("_PWrapper") _RWrapper = TypeVar("_RWrapper") -@overload -def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T, /) -> _T: ... +if sys.version_info >= (3, 14): + @overload + def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], /, initial: _T) -> _T: ... + +else: + @overload + def reduce(function: Callable[[_T, _S], _T], sequence: Iterable[_S], initial: _T, /) -> _T: ... + @overload def reduce(function: Callable[[_T, _T], _T], sequence: Iterable[_T], /) -> _T: ...