From 5021b3071192f54d98e86134e7106436cca261fe Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Sat, 21 Dec 2019 10:42:43 -0800 Subject: [PATCH] functools: remove first type param of cached_property (#3553) Fixes #3547 This removes some type safety in exceptional cases, like code that interacts directly with cached_property objects, but that seems like a price worth paying. --- stdlib/3/functools.pyi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index 477f51dd5..7e3fe6322 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -78,12 +78,12 @@ class _SingleDispatchCallable(Generic[_T]): def singledispatch(func: Callable[..., _T]) -> _SingleDispatchCallable[_T]: ... if sys.version_info >= (3, 8): - class cached_property(Generic[_S, _T]): - func: Callable[[_S], _T] + class cached_property(Generic[_T]): + func: Callable[[Any], _T] attrname: Optional[str] - def __init__(self, func: Callable[[_S], _T]) -> None: ... + def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: Optional[Type[_S]] = ...) -> cached_property[_S, _T]: ... + def __get__(self, instance: None, owner: Optional[Type[Any]] = ...) -> cached_property[_T]: ... @overload - def __get__(self, instance: _S, owner: Optional[Type[_S]] = ...) -> _T: ... - def __set_name__(self, owner: Type[_S], name: str) -> None: ... + def __get__(self, instance: _S, owner: Optional[Type[Any]] = ...) -> _T: ... + def __set_name__(self, owner: Type[Any], name: str) -> None: ...