Skip to content

Commit 53e3756

Browse files
committed
Handle operators consistently
1 parent 126abba commit 53e3756

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mypy/checker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3639,7 +3639,7 @@ def lvalue_type_from_base(
36393639
mx = MemberContext(
36403640
is_lvalue=setter_type,
36413641
is_super=False,
3642-
is_operator=False,
3642+
is_operator=mypy.checkexpr.is_operator_method(expr_name),
36433643
original_type=self_type,
36443644
context=expr_node,
36453645
chk=self,

test-data/unit/check-functools.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ from typing import Any, Callable, ClassVar
2828

2929
@total_ordering
3030
class Ord:
31-
__eq__: ClassVar[Callable[[Any, object], bool]] = lambda self, other: False
32-
__lt__: ClassVar[Callable[[Any, "Ord"], bool]] = lambda self, other: False
31+
__eq__: Callable[[Any, object], bool] = lambda self, other: False
32+
__lt__: Callable[[Any, "Ord"], bool] = lambda self, other: False
3333

3434
reveal_type(Ord() < Ord()) # N: Revealed type is "builtins.bool"
3535
reveal_type(Ord() <= Ord()) # N: Revealed type is "builtins.bool"

0 commit comments

Comments
 (0)