We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent9364902 commit8d59874Copy full SHA for 8d59874
vm/src/obj/objint.rs
@@ -287,6 +287,11 @@ fn int_neg(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
287
Ok(vm.ctx.new_int(-i))
288
}
289
290
+fnint_pos(vm:&mutVirtualMachine,args:PyFuncArgs) ->PyResult{
291
+arg_check!(vm, args, required =[(i,Some(vm.ctx.int_type()))]);
292
+Ok(i.clone())
293
+}
294
+
295
fnint_pow(vm:&mutVirtualMachine,args:PyFuncArgs) ->PyResult{
296
arg_check!(
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));
402
int_type.set_attr("__sub__", context.new_rustfunc(int_sub));