File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
com.oracle.graal.python.cext/src
com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ PyObject * PyLong_FromSsize_t(Py_ssize_t n) {
85
85
return PyLong_FromLongLong (n );
86
86
}
87
87
88
- UPCALL_ID (PyLong_FromLongLong );
88
+ UPCALL_ID (PyLong_FromDouble );
89
89
PyObject * PyLong_FromDouble (double n ) {
90
- return UPCALL_CEXT_O (_jls_PyLong_FromLongLong , n , 1 );
90
+ return UPCALL_CEXT_O (_jls_PyLong_FromDouble , n );
91
91
}
92
92
93
93
UPCALL_ID (ssize_t );
@@ -112,6 +112,7 @@ void * PyLong_AsVoidPtr(PyObject *obj){
112
112
return (void * )UPCALL_CEXT_L (_jls_PyLong_AsVoidPtr , native_to_java (obj ));
113
113
}
114
114
115
+ UPCALL_ID (PyLong_FromLongLong );
115
116
PyObject * PyLong_FromLong (long n ) {
116
117
return UPCALL_CEXT_O (_jls_PyLong_FromLongLong , n , 1 );
117
118
}
Original file line number Diff line number Diff line change 87
87
import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonObjectNativeWrapper ;
88
88
import com .oracle .graal .python .builtins .objects .cext .PythonNativeClass ;
89
89
import com .oracle .graal .python .builtins .objects .cext .PythonNativeNull ;
90
+ import com .oracle .graal .python .builtins .objects .cext .PythonNativeObject ;
90
91
import com .oracle .graal .python .builtins .objects .cext .PythonNativeVoidPtr ;
91
92
import com .oracle .graal .python .builtins .objects .cext .UnicodeObjectNodes .UnicodeAsWideCharNode ;
92
93
import com .oracle .graal .python .builtins .objects .code .PCode ;
@@ -1916,9 +1917,9 @@ private static BigInteger convertToBigInteger(long n) {
1916
1917
}
1917
1918
1918
1919
@ Specialization
1919
- Object doPointer (TruffleObject n , @ SuppressWarnings ("unused" ) int signed ,
1920
+ Object doPointer (PythonNativeObject n , @ SuppressWarnings ("unused" ) int signed ,
1920
1921
@ Cached ("create()" ) CExtNodes .ToSulongNode toSulongNode ) {
1921
- return toSulongNode .execute (n );
1922
+ return toSulongNode .execute (factory (). createNativeVoidPtr (( TruffleObject ) n . object ) );
1922
1923
}
1923
1924
}
1924
1925
Original file line number Diff line number Diff line change @@ -331,6 +331,11 @@ def _PyLong_Sign(n):
331
331
return 1
332
332
333
333
334
+ @may_raise
335
+ def PyLong_FromDouble (d ):
336
+ return int (d )
337
+
338
+
334
339
@may_raise
335
340
def PyLong_FromString (string , base , negative ):
336
341
result = int (string , base )
You can’t perform that action at this time.
0 commit comments