From 15226916adb89e58f8d0803d597f8425566e1307 Mon Sep 17 00:00:00 2001 From: Randolf Scholz Date: Fri, 30 Jan 2026 18:51:24 +0100 Subject: [PATCH] Loosen argument type for __eq__ and __ne__ methods to Any in builtins.pyi --- stdlib/builtins.pyi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index efc51fe257ae..25a3093203f5 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -121,8 +121,10 @@ class object: # Overriding them in subclasses has different semantics, even if the override has an identical signature. def __setattr__(self, name: str, value: Any, /) -> None: ... def __delattr__(self, name: str, /) -> None: ... - def __eq__(self, value: object, /) -> bool: ... - def __ne__(self, value: object, /) -> bool: ... + # Note: Using `Any` for the argument type rather than `object` so that + # subclasses can override with a more specific type. + def __eq__(self, value: Any, /) -> bool: ... # noqa: Y032 + def __ne__(self, value: Any, /) -> bool: ... # noqa: Y032 def __str__(self) -> str: ... # noqa: Y029 def __repr__(self) -> str: ... # noqa: Y029 def __hash__(self) -> int: ...