File tree 3 files changed +14
-3
lines changed
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -150,8 +150,6 @@ def test_tolist(self):
150
150
l = m .tolist ()
151
151
self .assertEqual (l , list (b"abcdef" ))
152
152
153
- # TODO: RUSTPYTHON
154
- @unittest .expectedFailure
155
153
def test_compare (self ):
156
154
# memoryviews can compare for equality with other objects
157
155
# having the buffer interface.
Original file line number Diff line number Diff line change @@ -531,6 +531,16 @@ impl Comparable for PyBytes {
531
531
) -> PyResult < PyComparisonValue > {
532
532
Ok ( if let Some ( res) = op. identical_optimization ( zelf, other) {
533
533
res. into ( )
534
+ } else if other. isinstance ( & vm. ctx . types . memoryview_type )
535
+ && op != PyComparisonOp :: Eq
536
+ && op != PyComparisonOp :: Ne
537
+ {
538
+ return Err ( vm. new_type_error ( format ! (
539
+ "'{}' not supported between instances of '{}' and '{}'" ,
540
+ op. operator_token( ) ,
541
+ zelf. class( ) . name,
542
+ other. class( ) . name
543
+ ) ) ) ;
534
544
} else {
535
545
zelf. inner . cmp ( other, op, vm)
536
546
} )
Original file line number Diff line number Diff line change @@ -711,7 +711,10 @@ impl PyMemoryView {
711
711
return Ok ( false ) ;
712
712
}
713
713
714
- let other = try_buffer_from_object ( vm, other) ?;
714
+ let other = match try_buffer_from_object ( vm, other) {
715
+ Ok ( buf) => buf,
716
+ Err ( _) => return Ok ( false ) ,
717
+ } ;
715
718
716
719
let a_options = & zelf. options ;
717
720
let b_options = other. get_options ( ) ;
You can’t perform that action at this time.
0 commit comments