Skip to content

Commit 1522691

Browse files
Loosen argument type for __eq__ and __ne__ methods to Any in builtins.pyi
1 parent 31c195a commit 1522691

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/builtins.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ class object:
121121
# Overriding them in subclasses has different semantics, even if the override has an identical signature.
122122
def __setattr__(self, name: str, value: Any, /) -> None: ...
123123
def __delattr__(self, name: str, /) -> None: ...
124-
def __eq__(self, value: object, /) -> bool: ...
125-
def __ne__(self, value: object, /) -> bool: ...
124+
# Note: Using `Any` for the argument type rather than `object` so that
125+
# subclasses can override with a more specific type.
126+
def __eq__(self, value: Any, /) -> bool: ... # noqa: Y032
127+
def __ne__(self, value: Any, /) -> bool: ... # noqa: Y032
126128
def __str__(self) -> str: ... # noqa: Y029
127129
def __repr__(self) -> str: ... # noqa: Y029
128130
def __hash__(self) -> int: ...

0 commit comments

Comments
 (0)