From ecb43149f7fd3ea282a362a3c3235a2b04ea03ad Mon Sep 17 00:00:00 2001 From: Shantanu Date: Wed, 10 Jun 2020 22:05:16 -0700 Subject: [PATCH] builtins: NotImplemented is not callable (#4222) Fixes #3315 Co-authored-by: hauntsaninja <> --- stdlib/2/__builtin__.pyi | 7 ++++++- stdlib/2and3/builtins.pyi | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 5ca157d69..4c531454d 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -1163,7 +1163,12 @@ class property(object): if sys.version_info < (3,): long = int -NotImplemented: Any +class _NotImplementedType(Any): # type: ignore + # A little weird, but typing the __call__ as NotImplemented makes the error message + # for NotImplemented() much better + __call__: NotImplemented # type: ignore + +NotImplemented: _NotImplementedType def abs(__x: SupportsAbs[_T]) -> _T: ... def all(__iterable: Iterable[object]) -> bool: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 5ca157d69..4c531454d 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -1163,7 +1163,12 @@ class property(object): if sys.version_info < (3,): long = int -NotImplemented: Any +class _NotImplementedType(Any): # type: ignore + # A little weird, but typing the __call__ as NotImplemented makes the error message + # for NotImplemented() much better + __call__: NotImplemented # type: ignore + +NotImplemented: _NotImplementedType def abs(__x: SupportsAbs[_T]) -> _T: ... def all(__iterable: Iterable[object]) -> bool: ...