@@ -29,6 +29,12 @@ impl PyInt {
29
29
}
30
30
}
31
31
32
+ impl IntoPyObject for BigInt {
33
+ fn into_pyobject ( self , ctx : & PyContext ) -> PyResult {
34
+ Ok ( ctx. new_int ( self ) )
35
+ }
36
+ }
37
+
32
38
impl PyValue for PyInt {
33
39
fn required_type ( ctx : & PyContext ) -> PyObjectRef {
34
40
ctx. int_type ( )
@@ -312,8 +318,8 @@ impl PyIntRef {
312
318
}
313
319
}
314
320
315
- fn neg ( self , vm : & mut VirtualMachine ) -> PyObjectRef {
316
- vm . ctx . new_int ( -( & self . value ) )
321
+ fn neg ( self , _vm : & mut VirtualMachine ) -> BigInt {
322
+ -( & self . value )
317
323
}
318
324
319
325
fn hash ( self , _vm : & mut VirtualMachine ) -> u64 {
@@ -322,8 +328,8 @@ impl PyIntRef {
322
328
hasher. finish ( )
323
329
}
324
330
325
- fn abs ( self , vm : & mut VirtualMachine ) -> PyObjectRef {
326
- vm . ctx . new_int ( self . value . abs ( ) )
331
+ fn abs ( self , _vm : & mut VirtualMachine ) -> BigInt {
332
+ self . value . abs ( )
327
333
}
328
334
329
335
fn round ( self , _precision : OptionalArg < PyObjectRef > , _vm : & mut VirtualMachine ) -> Self {
@@ -334,8 +340,8 @@ impl PyIntRef {
334
340
self . value . to_f64 ( ) . unwrap ( )
335
341
}
336
342
337
- fn invert ( self , vm : & mut VirtualMachine ) -> PyObjectRef {
338
- vm . ctx . new_int ( !( & self . value ) )
343
+ fn invert ( self , _vm : & mut VirtualMachine ) -> BigInt {
344
+ !( & self . value )
339
345
}
340
346
341
347
fn repr ( self , _vm : & mut VirtualMachine ) -> String {
0 commit comments