Skip to content

Commit ea368c7

Browse files
authored
Type __call__ on builtins._NotImplementedType as None. (#12984)
Currently, this is intentionally incorrectly typed in order to produce a better mypy error message. But pyright (and presumably other type checkers) end up just treating instances of _NotImplementedType as callable. With this change, the mypy error message gets a little worse, but other type checkers can understand that instances of _NotImplementedType aren't callable, which I think is an improvement.
1 parent 76537eb commit ea368c7

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

stdlib/builtins.pyi

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,9 +1284,7 @@ class property:
12841284

12851285
@final
12861286
class _NotImplementedType(Any):
1287-
# A little weird, but typing the __call__ as NotImplemented makes the error message
1288-
# for NotImplemented() much better
1289-
__call__: NotImplemented # type: ignore[valid-type] # pyright: ignore[reportInvalidTypeForm]
1287+
__call__: None
12901288

12911289
NotImplemented: _NotImplementedType
12921290

0 commit comments

Comments
 (0)