File tree 1 file changed +6
-0
lines changed 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -287,6 +287,11 @@ fn int_neg(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
287
287
Ok ( vm. ctx . new_int ( -i) )
288
288
}
289
289
290
+ fn int_pos ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
291
+ arg_check ! ( vm, args, required = [ ( i, Some ( vm. ctx. int_type( ) ) ) ] ) ;
292
+ Ok ( i. clone ( ) )
293
+ }
294
+
290
295
fn int_pow ( vm : & mut VirtualMachine , args : PyFuncArgs ) -> PyResult {
291
296
arg_check ! (
292
297
vm,
@@ -391,6 +396,7 @@ pub fn init(context: &PyContext) {
391
396
int_type. set_attr ( "__mul__" , context. new_rustfunc ( int_mul) ) ;
392
397
int_type. set_attr ( "__neg__" , context. new_rustfunc ( int_neg) ) ;
393
398
int_type. set_attr ( "__or__" , context. new_rustfunc ( int_or) ) ;
399
+ int_type. set_attr ( "__pos__" , context. new_rustfunc ( int_pos) ) ;
394
400
int_type. set_attr ( "__pow__" , context. new_rustfunc ( int_pow) ) ;
395
401
int_type. set_attr ( "__repr__" , context. new_rustfunc ( int_repr) ) ;
396
402
int_type. set_attr ( "__sub__" , context. new_rustfunc ( int_sub) ) ;
You can’t perform that action at this time.
0 commit comments