From 591522fb6a527318ea100d8adf99d91e662ba26f Mon Sep 17 00:00:00 2001 From: Shantanu Date: Fri, 3 Apr 2020 17:17:26 -0700 Subject: [PATCH] functools.singledispatchmethod: add __call__ for better results (#3899) It doesn't actually have __call__, it does some descriptor stuff, but this makes things work. _SingleDispatchCallable has a __call__ too, which is what this mirrors. Fixes #3898 --- stdlib/3/functools.pyi | 1 + tests/stubtest_whitelists/py38.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/stdlib/3/functools.pyi b/stdlib/3/functools.pyi index 3b57064dc..10469c183 100644 --- a/stdlib/3/functools.pyi +++ b/stdlib/3/functools.pyi @@ -86,6 +86,7 @@ if sys.version_info >= (3, 8): def register(self, cls: Any, method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload def register(self, cls: Any, method: Callable[..., _T]) -> Callable[..., _T]: ... + def __call__(self, *args: Any, **kwargs: Any) -> _T: ... class cached_property(Generic[_T]): func: Callable[[Any], _T] diff --git a/tests/stubtest_whitelists/py38.txt b/tests/stubtest_whitelists/py38.txt index 19ecf2430..95be7c1b7 100644 --- a/tests/stubtest_whitelists/py38.txt +++ b/tests/stubtest_whitelists/py38.txt @@ -97,6 +97,7 @@ dis.stack_effect email.message.MIMEPart.as_string enum.Enum._generate_next_value_ functools.partialmethod.__get__ +functools.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable gettext.install gettext.translation hmac.compare_digest