From d17e364e361ac65a6bf032098d4f3a0d24ada1b3 Mon Sep 17 00:00:00 2001 From: hauntsaninja <> Date: Wed, 10 Jun 2020 21:08:41 -0700 Subject: [PATCH] builtins: NotImplemented is not callable Fixes #3315 --- 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 5ca157d69f18..4c531454dc49 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 5ca157d69f18..4c531454dc49 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: ...