File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,28 @@ pub fn init(context: &PyContext) {
101
101
object. set_attr ( "__hash__" , context. new_rustfunc ( object_hash) ) ;
102
102
object. set_attr ( "__str__" , context. new_rustfunc ( object_str) ) ;
103
103
object. set_attr ( "__repr__" , context. new_rustfunc ( object_repr) ) ;
104
+ object. set_attr ( "__and__" , context. new_rustfunc ( object_and) ) ;
104
105
}
105
106
106
107
fn object_init ( vm : & mut VirtualMachine , _args : PyFuncArgs ) -> PyResult {
107
108
Ok ( vm. ctx . none ( ) )
108
109
}
109
110
111
+ fn object_and ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
112
+ arg_check ! (
113
+ vm,
114
+ args,
115
+ required = [
116
+ ( zelf, None ) ,
117
+ ( other, None )
118
+ ]
119
+ ) ;
120
+
121
+ let zelf_type = objtype:: get_type_name ( & zelf. typ ( ) ) ;
122
+ let other_type = objtype:: get_type_name ( & other. typ ( ) ) ;
123
+ Err ( vm. new_type_error ( format ! ( "unsupported operand type(s) for &: {:?} and {:?}" , zelf_type, other_type) ) )
124
+ }
125
+
110
126
fn object_dict ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
111
127
match args. args [ 0 ] . borrow ( ) . kind {
112
128
PyObjectKind :: Class { ref dict, .. } => Ok ( dict. clone ( ) ) ,
You can’t perform that action at this time.
0 commit comments