@@ -7,7 +7,7 @@ use crate::pyobject::{
7
7
} ;
8
8
use crate :: vm:: VirtualMachine ;
9
9
10
- use super :: objint:: PyInt ;
10
+ use super :: objint:: { self , PyInt } ;
11
11
use super :: objstr:: PyStringRef ;
12
12
use super :: objtype;
13
13
@@ -111,7 +111,7 @@ pub fn not(vm: &VirtualMachine, obj: &PyObjectRef) -> PyResult<bool> {
111
111
112
112
// Retrieve inner int value:
113
113
pub fn get_value ( obj : & PyObjectRef ) -> bool {
114
- !obj . payload :: < PyInt > ( ) . unwrap ( ) . as_bigint ( ) . is_zero ( )
114
+ !objint :: get_py_int ( obj ) . as_bigint ( ) . is_zero ( )
115
115
}
116
116
117
117
fn bool_repr ( obj : bool , _vm : & VirtualMachine ) -> String {
@@ -142,7 +142,7 @@ fn bool_or(lhs: PyObjectRef, rhs: PyObjectRef, vm: &VirtualMachine) -> PyResult
142
142
let rhs = get_value ( & rhs) ;
143
143
( lhs || rhs) . into_pyobject ( vm)
144
144
} else {
145
- Ok ( lhs . payload :: < PyInt > ( ) . unwrap ( ) . or ( rhs. clone ( ) , vm) )
145
+ Ok ( objint :: get_py_int ( & lhs ) . or ( rhs. clone ( ) , vm) )
146
146
}
147
147
}
148
148
@@ -154,7 +154,7 @@ fn bool_and(lhs: PyObjectRef, rhs: PyObjectRef, vm: &VirtualMachine) -> PyResult
154
154
let rhs = get_value ( & rhs) ;
155
155
( lhs && rhs) . into_pyobject ( vm)
156
156
} else {
157
- Ok ( lhs . payload :: < PyInt > ( ) . unwrap ( ) . and ( rhs. clone ( ) , vm) )
157
+ Ok ( objint :: get_py_int ( & lhs ) . and ( rhs. clone ( ) , vm) )
158
158
}
159
159
}
160
160
@@ -166,7 +166,7 @@ fn bool_xor(lhs: PyObjectRef, rhs: PyObjectRef, vm: &VirtualMachine) -> PyResult
166
166
let rhs = get_value ( & rhs) ;
167
167
( lhs ^ rhs) . into_pyobject ( vm)
168
168
} else {
169
- Ok ( lhs . payload :: < PyInt > ( ) . unwrap ( ) . xor ( rhs. clone ( ) , vm) )
169
+ Ok ( objint :: get_py_int ( & lhs ) . xor ( rhs. clone ( ) , vm) )
170
170
}
171
171
}
172
172
0 commit comments