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 @@ -862,6 +862,10 @@ def _add_comparison_ops(cls):
862
862
cls .__le__ = cls ._create_comparison_method (operator .le )
863
863
cls .__ge__ = cls ._create_comparison_method (operator .ge )
864
864
865
+ def _validate_shape (self , other ):
866
+ if len (self ) != len (other ):
867
+ raise ValueError ('Lengths must match to compare' )
868
+
865
869
866
870
class ExtensionScalarOpsMixin (ExtensionOpsMixin ):
867
871
"""
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