File tree Expand file tree Collapse file tree
com.oracle.graal.python.cext/src
com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,9 +85,9 @@ PyObject * PyLong_FromSsize_t(Py_ssize_t n) {
8585 return PyLong_FromLongLong (n );
8686}
8787
88- UPCALL_ID (PyLong_FromLongLong );
88+ UPCALL_ID (PyLong_FromDouble );
8989PyObject * PyLong_FromDouble (double n ) {
90- return UPCALL_CEXT_O (_jls_PyLong_FromLongLong , n , 1 );
90+ return UPCALL_CEXT_O (_jls_PyLong_FromDouble , n );
9191}
9292
9393UPCALL_ID (ssize_t );
@@ -112,6 +112,7 @@ void * PyLong_AsVoidPtr(PyObject *obj){
112112 return (void * )UPCALL_CEXT_L (_jls_PyLong_AsVoidPtr , native_to_java (obj ));
113113}
114114
115+ UPCALL_ID (PyLong_FromLongLong );
115116PyObject * PyLong_FromLong (long n ) {
116117 return UPCALL_CEXT_O (_jls_PyLong_FromLongLong , n , 1 );
117118}
Original file line number Diff line number Diff line change 8787import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonObjectNativeWrapper ;
8888import com .oracle .graal .python .builtins .objects .cext .PythonNativeClass ;
8989import com .oracle .graal .python .builtins .objects .cext .PythonNativeNull ;
90+ import com .oracle .graal .python .builtins .objects .cext .PythonNativeObject ;
9091import com .oracle .graal .python .builtins .objects .cext .PythonNativeVoidPtr ;
9192import com .oracle .graal .python .builtins .objects .cext .UnicodeObjectNodes .UnicodeAsWideCharNode ;
9293import com .oracle .graal .python .builtins .objects .code .PCode ;
@@ -1916,9 +1917,9 @@ private static BigInteger convertToBigInteger(long n) {
19161917 }
19171918
19181919 @ Specialization
1919- Object doPointer (TruffleObject n , @ SuppressWarnings ("unused" ) int signed ,
1920+ Object doPointer (PythonNativeObject n , @ SuppressWarnings ("unused" ) int signed ,
19201921 @ Cached ("create()" ) CExtNodes .ToSulongNode toSulongNode ) {
1921- return toSulongNode .execute (n );
1922+ return toSulongNode .execute (factory (). createNativeVoidPtr (( TruffleObject ) n . object ) );
19221923 }
19231924 }
19241925
Original file line number Diff line number Diff line change @@ -331,6 +331,11 @@ def _PyLong_Sign(n):
331331 return 1
332332
333333
334+ @may_raise
335+ def PyLong_FromDouble (d ):
336+ return int (d )
337+
338+
334339@may_raise
335340def PyLong_FromString (string , base , negative ):
336341 result = int (string , base )
You can’t perform that action at this time.
0 commit comments