File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed
com.oracle.graal.python.cext/src
com.oracle.graal.python.test/src/tests/cpyext
com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ PyObject * PyLong_FromVoidPtr(void *p) {
109
109
110
110
UPCALL_ID (PyLong_AsVoidPtr );
111
111
void * PyLong_AsVoidPtr (PyObject * obj ){
112
- return (void * )UPCALL_CEXT_L (_jls_PyLong_AsVoidPtr , native_to_java (obj ));
112
+ return (void * )UPCALL_CEXT_PTR (_jls_PyLong_AsVoidPtr , native_to_java (obj ));
113
113
}
114
114
115
115
UPCALL_ID (PyLong_FromLongLong );
Original file line number Diff line number Diff line change @@ -239,6 +239,38 @@ def compile_module(self, name):
239
239
cmpfunc = unhandled_error_compare
240
240
)
241
241
242
+ test_PyLong_FromVoidPtrAllocated = CPyExtFunction (
243
+ lambda args : int ,
244
+ lambda : ((None ,),),
245
+ code = """PyObject* PyLong_FromVoidPtrAllocated(PyObject* none) {
246
+ void* dummyPtr = malloc(sizeof(size_t));
247
+ return (PyObject*)Py_TYPE(PyLong_FromVoidPtr(dummyPtr));
248
+ }
249
+ """ ,
250
+ resultspec = "O" ,
251
+ argspec = 'O' ,
252
+ arguments = ["PyObject* none" ],
253
+ cmpfunc = unhandled_error_compare
254
+ )
255
+
256
+ test_PyLong_AsVoidPtrAllocated = CPyExtFunction (
257
+ lambda args : True ,
258
+ lambda : ((None ,),),
259
+ code = """PyObject* PyLong_AsVoidPtrAllocated(PyObject* none) {
260
+ void* dummyPtr = malloc(sizeof(size_t));
261
+ PyObject* obj = PyLong_FromVoidPtr(dummyPtr);
262
+ void* unwrappedPtr = PyLong_AsVoidPtr(obj);
263
+ PyObject* result = unwrappedPtr == dummyPtr ? Py_True : Py_False;
264
+ free(dummyPtr);
265
+ return result;
266
+ }
267
+ """ ,
268
+ resultspec = "O" ,
269
+ argspec = 'O' ,
270
+ arguments = ["PyObject* none" ],
271
+ cmpfunc = unhandled_error_compare
272
+ )
273
+
242
274
test_PyLong_Check = CPyExtFunction (
243
275
lambda args : isinstance (args [0 ], int ),
244
276
lambda : (
Original file line number Diff line number Diff line change @@ -1150,7 +1150,7 @@ long runGeneric(Object value) {
1150
1150
private CastToIndexNode getIntNode () {
1151
1151
if (intNode == null ) {
1152
1152
CompilerDirectives .transferToInterpreterAndInvalidate ();
1153
- intNode = CastToIndexNode .createOverflow ();
1153
+ intNode = insert ( CastToIndexNode .createOverflow () );
1154
1154
}
1155
1155
return intNode ;
1156
1156
}
You can’t perform that action at this time.
0 commit comments