Skip to content

Commit 591522f

Browse files
authored
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
1 parent 5f4ad2b commit 591522f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

stdlib/3/functools.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ if sys.version_info >= (3, 8):
8686
def register(self, cls: Any, method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
8787
@overload
8888
def register(self, cls: Any, method: Callable[..., _T]) -> Callable[..., _T]: ...
89+
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
8990

9091
class cached_property(Generic[_T]):
9192
func: Callable[[Any], _T]

tests/stubtest_whitelists/py38.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ dis.stack_effect
9797
email.message.MIMEPart.as_string
9898
enum.Enum._generate_next_value_
9999
functools.partialmethod.__get__
100+
functools.singledispatchmethod.__call__ # A lie to reflect that the descriptor get returns a callable
100101
gettext.install
101102
gettext.translation
102103
hmac.compare_digest

0 commit comments

Comments
 (0)