Don't include lambdas in __eq__ for BinOp

When using forward refs, inline lambdas in Annotated are re-evaluated for every subclass, thus making the comparison fail
This commit is contained in:
Nuno Campos
2024-07-19 14:46:01 -07:00
parent 9d14f4f2f1
commit 4dc1195bcd
+5 -3
View File
@@ -56,9 +56,11 @@ class BinaryOperatorAggregate(Generic[Value], BaseChannel[Value, Value, Value]):
pass
def __eq__(self, value: object) -> bool:
return (
isinstance(value, BinaryOperatorAggregate)
and value.operator == self.operator
return isinstance(value, BinaryOperatorAggregate) and (
value.operator is self.operator
if value.operator.__name__ != "<lambda>"
and self.operator.__name__ != "<lambda>"
else True
)
@property