mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
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.
This commit is contained in:
@@ -1284,9 +1284,7 @@ class property:
|
||||
|
||||
@final
|
||||
class _NotImplementedType(Any):
|
||||
# A little weird, but typing the __call__ as NotImplemented makes the error message
|
||||
# for NotImplemented() much better
|
||||
__call__: NotImplemented # type: ignore[valid-type] # pyright: ignore[reportInvalidTypeForm]
|
||||
__call__: None
|
||||
|
||||
NotImplemented: _NotImplementedType
|
||||
|
||||
|
||||
Reference in New Issue
Block a user