File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
com.oracle.graal.python.cext/src
com.oracle.graal.python/src/com/oracle/graal/python/runtime/object Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ static PyObject* null_error(void) {
54
54
}
55
55
56
56
int PyNumber_Check (PyObject * o ) {
57
- PyObject * result = truffle_invoke (PY_TRUFFLE_CEXT , "PyNumber_Check" , to_java (o ));
57
+ PyObject * result = to_sulong ( truffle_invoke (PY_TRUFFLE_CEXT , "PyNumber_Check" , to_java (o ) ));
58
58
if (result == Py_True ) {
59
59
return 1 ;
60
60
}
Original file line number Diff line number Diff line change @@ -201,9 +201,18 @@ public PythonNativeObject createNativeObjectWrapper(Object obj) {
201
201
/*
202
202
* Primitive types
203
203
*/
204
+ @ CompilationFinal PInt pyTrue = null ;
205
+ @ CompilationFinal PInt pyFalse = null ;
204
206
205
207
public PInt createInt (boolean value ) {
206
- return trace (new PInt (lookupClass (PythonBuiltinClassType .Boolean ), value ? BigInteger .ONE : BigInteger .ZERO ));
208
+ if (value && pyTrue == null ) {
209
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
210
+ pyTrue = new PInt (lookupClass (PythonBuiltinClassType .Boolean ), BigInteger .ONE );
211
+ } else if (!value && pyFalse == null ) {
212
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
213
+ pyFalse = new PInt (lookupClass (PythonBuiltinClassType .Boolean ), BigInteger .ZERO );
214
+ }
215
+ return value ? pyTrue : pyFalse ;
207
216
}
208
217
209
218
public PInt createInt (int value ) {
You can’t perform that action at this time.
0 commit comments