@@ -26,6 +26,7 @@ use crate::{
26
26
} ;
27
27
use rustpython_common:: lock:: PyMutex ;
28
28
use std:: fmt;
29
+ use crate :: sequence:: ObjectSequenceOp ;
29
30
30
31
pub type DictContentType = dictdatatype:: Dict ;
31
32
@@ -998,7 +999,7 @@ trait ViewSetOps: DictView {
998
999
) -> PyResult < PyComparisonValue > {
999
1000
match_class ! ( match other {
1000
1001
ref dictview @ Self => {
1001
- PyDict :: inner_cmp(
1002
+ return PyDict :: inner_cmp(
1002
1003
zelf. dict( ) ,
1003
1004
dictview. dict( ) ,
1004
1005
op,
@@ -1009,12 +1010,22 @@ trait ViewSetOps: DictView {
1009
1010
ref _set @ PySet => {
1010
1011
let inner = Self :: to_set( zelf. to_owned( ) , vm) ?;
1011
1012
let zelf_set = PySet { inner } . into_pyobject( vm) ;
1012
- PySet :: cmp( zelf_set. downcast_ref( ) . unwrap( ) , other, op, vm)
1013
+ return PySet :: cmp( zelf_set. downcast_ref( ) . unwrap( ) , other, op, vm) ;
1013
1014
}
1015
+ ref _dictitems @ PyDictItems => { }
1016
+ ref _dictkeys @ PyDictKeys => { }
1014
1017
_ => {
1015
- Ok ( NotImplemented )
1018
+ return Ok ( NotImplemented ) ;
1016
1019
}
1017
- } )
1020
+ } ) ;
1021
+ let self_vec: Vec < PyObjectRef > = zelf. as_object ( ) . to_owned ( ) . try_into_value ( vm) ?;
1022
+ let other_vec: Vec < PyObjectRef > = other. to_owned ( ) . try_into_value ( vm) ?;
1023
+ let res = self_vec. eq ( vm, & other_vec) ?;
1024
+ match op {
1025
+ PyComparisonOp :: Eq => Ok ( Implemented ( res) ) ,
1026
+ PyComparisonOp :: Ne => Ok ( Implemented ( !res) ) ,
1027
+ _ => Ok ( NotImplemented ) ,
1028
+ }
1018
1029
}
1019
1030
1020
1031
#[ pymethod]
0 commit comments