File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
Expand file tree Collapse file tree 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):
150150 l = m .tolist ()
151151 self .assertEqual (l , list (b"abcdef" ))
152152
153- # TODO: RUSTPYTHON
154- @unittest .expectedFailure
155153 def test_compare (self ):
156154 # memoryviews can compare for equality with other objects
157155 # having the buffer interface.
Original file line number Diff line number Diff line change @@ -531,6 +531,16 @@ impl Comparable for PyBytes {
531531 ) -> PyResult < PyComparisonValue > {
532532 Ok ( if let Some ( res) = op. identical_optimization ( zelf, other) {
533533 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+ ) ) ) ;
534544 } else {
535545 zelf. inner . cmp ( other, op, vm)
536546 } )
Original file line number Diff line number Diff line change @@ -711,7 +711,10 @@ impl PyMemoryView {
711711 return Ok ( false ) ;
712712 }
713713
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+ } ;
715718
716719 let a_options = & zelf. options ;
717720 let b_options = other. get_options ( ) ;
You can’t perform that action at this time.
0 commit comments