File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -891,6 +891,10 @@ def _add_comparison_ops(cls):
891
891
cls .__le__ = cls ._create_comparison_method (operator .le )
892
892
cls .__ge__ = cls ._create_comparison_method (operator .ge )
893
893
894
+ def _validate_shape (self , other ):
895
+ if len (self ) != len (other ):
896
+ raise ValueError ('Lengths must match to compare' )
897
+
894
898
895
899
class ExtensionScalarOpsMixin (ExtensionOpsMixin ):
896
900
"""
Original file line number Diff line number Diff line change @@ -68,8 +68,7 @@ def wrapper(self, other):
68
68
elif isinstance (other , cls ):
69
69
self ._check_compatible_with (other )
70
70
71
- if other .ndim > 0 and len (self ) != len (other ):
72
- raise ValueError ('Lengths must match to compare' )
71
+ self ._validate_shape (other )
73
72
74
73
if not_implemented :
75
74
return NotImplemented
You can’t perform that action at this time.
0 commit comments