@@ -549,27 +549,27 @@ impl VirtualMachine {
549549 }
550550
551551 pub fn _add ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
552- self . call_method ( & a, "__add__" , vec ! [ b ] )
552+ self . call_or_unsupported ( a, b , "__add__" , "__radd__" , "+" )
553553 }
554554
555555 pub fn _mul ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
556- self . call_method ( & a, "__mul__" , vec ! [ b ] )
556+ self . call_or_unsupported ( a, b , "__mul__" , "__rmul__" , "*" )
557557 }
558558
559559 pub fn _div ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
560- self . call_method ( & a, "__truediv__" , vec ! [ b ] )
560+ self . call_or_unsupported ( a, b , "__truediv__" , "__truediv__" , "/" )
561561 }
562562
563563 pub fn _pow ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
564- self . call_method ( & a, "__pow__" , vec ! [ b ] )
564+ self . call_or_unsupported ( a, b , "__pow__" , "__rpow__" , "**" )
565565 }
566566
567567 pub fn _modulo ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
568- self . call_method ( & a, "__mod__" , vec ! [ b ] )
568+ self . call_or_unsupported ( a, b , "__mod__" , "__rmod__" , "%" )
569569 }
570570
571571 pub fn _xor ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
572- self . call_method ( & a, "__xor__" , vec ! [ b ] )
572+ self . call_or_unsupported ( a, b , "__xor__" , "__rxor__" , "^" )
573573 }
574574
575575 pub fn _or ( & mut self , a : PyObjectRef , b : PyObjectRef ) -> PyResult {
0 commit comments