From 0cd7dd7009fd0bafb5338f113f1363069b42d533 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Wed, 23 Sep 2020 23:35:19 +0200 Subject: [PATCH] Fix _patch.__call__() (#4568) _patch.call() reused the type variable _T, which is generic over _patch. It was meant to use a separate type variable for the argument, which is returned. Fixes #4566 --- stdlib/3/unittest/mock.pyi | 2 +- third_party/2and3/mock.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/unittest/mock.pyi b/stdlib/3/unittest/mock.pyi index b47e3f6ba..0c34f72dd 100644 --- a/stdlib/3/unittest/mock.pyi +++ b/stdlib/3/unittest/mock.pyi @@ -193,7 +193,7 @@ class _patch(Generic[_T]): kwargs: Mapping[str, Any], ) -> None: ... def copy(self) -> _patch[_T]: ... - def __call__(self, func: _T) -> _T: ... + def __call__(self, func: _F) -> _F: ... def decorate_class(self, klass: _TT) -> _TT: ... def decorate_callable(self, func: _F) -> _F: ... def get_original(self) -> Tuple[Any, bool]: ... diff --git a/third_party/2and3/mock.pyi b/third_party/2and3/mock.pyi index b47e3f6ba..0c34f72dd 100644 --- a/third_party/2and3/mock.pyi +++ b/third_party/2and3/mock.pyi @@ -193,7 +193,7 @@ class _patch(Generic[_T]): kwargs: Mapping[str, Any], ) -> None: ... def copy(self) -> _patch[_T]: ... - def __call__(self, func: _T) -> _T: ... + def __call__(self, func: _F) -> _F: ... def decorate_class(self, klass: _TT) -> _TT: ... def decorate_callable(self, func: _F) -> _F: ... def get_original(self) -> Tuple[Any, bool]: ...