@@ -134,11 +134,13 @@ fn int_lt(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
134134 arg_check ! (
135135 vm,
136136 args,
137- required = [
138- ( zelf, Some ( vm. ctx. int_type( ) ) ) ,
139- ( other, Some ( vm. ctx. int_type( ) ) )
140- ]
137+ required = [ ( zelf, Some ( vm. ctx. int_type( ) ) ) , ( other, None ) ]
141138 ) ;
139+
140+ if !objtype:: isinstance ( other, & vm. ctx . int_type ( ) ) {
141+ return Ok ( vm. ctx . not_implemented ( ) ) ;
142+ }
143+
142144 let zelf = BigInt :: from_pyobj ( zelf) ;
143145 let other = BigInt :: from_pyobj ( other) ;
144146 let result = zelf < other;
@@ -149,11 +151,13 @@ fn int_le(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
149151 arg_check ! (
150152 vm,
151153 args,
152- required = [
153- ( zelf, Some ( vm. ctx. int_type( ) ) ) ,
154- ( other, Some ( vm. ctx. int_type( ) ) )
155- ]
154+ required = [ ( zelf, Some ( vm. ctx. int_type( ) ) ) , ( other, None ) ]
156155 ) ;
156+
157+ if !objtype:: isinstance ( other, & vm. ctx . int_type ( ) ) {
158+ return Ok ( vm. ctx . not_implemented ( ) ) ;
159+ }
160+
157161 let zelf = BigInt :: from_pyobj ( zelf) ;
158162 let other = BigInt :: from_pyobj ( other) ;
159163 let result = zelf <= other;
@@ -164,11 +168,13 @@ fn int_gt(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
164168 arg_check ! (
165169 vm,
166170 args,
167- required = [
168- ( zelf, Some ( vm. ctx. int_type( ) ) ) ,
169- ( other, Some ( vm. ctx. int_type( ) ) )
170- ]
171+ required = [ ( zelf, Some ( vm. ctx. int_type( ) ) ) , ( other, None ) ]
171172 ) ;
173+
174+ if !objtype:: isinstance ( other, & vm. ctx . int_type ( ) ) {
175+ return Ok ( vm. ctx . not_implemented ( ) ) ;
176+ }
177+
172178 let zelf = BigInt :: from_pyobj ( zelf) ;
173179 let other = BigInt :: from_pyobj ( other) ;
174180 let result = zelf > other;
@@ -179,11 +185,13 @@ fn int_ge(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
179185 arg_check ! (
180186 vm,
181187 args,
182- required = [
183- ( zelf, Some ( vm. ctx. int_type( ) ) ) ,
184- ( other, Some ( vm. ctx. int_type( ) ) )
185- ]
188+ required = [ ( zelf, Some ( vm. ctx. int_type( ) ) ) , ( other, None ) ]
186189 ) ;
190+
191+ if !objtype:: isinstance ( other, & vm. ctx . int_type ( ) ) {
192+ return Ok ( vm. ctx . not_implemented ( ) ) ;
193+ }
194+
187195 let zelf = BigInt :: from_pyobj ( zelf) ;
188196 let other = BigInt :: from_pyobj ( other) ;
189197 let result = zelf >= other;
0 commit comments