File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
graalpython/com.oracle.graal.python.cext/src Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -235,13 +235,19 @@ void* get_ob_type(PyObject* obj) {
235
235
if (!truffle_cannot_be_handle (type )) {
236
236
return resolve_handle (cache , (uint64_t )type );
237
237
} else {
238
- // we have stored a handle to the Java class in ob_refcnt
239
- void * handle = (void * )((PyObject * )type )-> ob_refcnt ;
240
- if (!truffle_cannot_be_handle (handle )) {
241
- return resolve_handle (cache , (uint64_t )handle );
238
+ PyObject * cast_type = ((PyObject * )type );
239
+ if (!polyglot_is_value (cast_type )) {
240
+ // we have stored a handle to the Java class in ob_refcnt
241
+ void * handle = (void * )(cast_type -> ob_refcnt );
242
+ if (!truffle_cannot_be_handle (handle )) {
243
+ return resolve_handle (cache , (uint64_t )handle );
244
+ } else {
245
+ // assume handle is a TruffleObject
246
+ return handle ;
247
+ }
242
248
} else {
243
- // assume handle is a TruffleObject
244
- return handle ;
249
+ // the type is already the right value (e.g. on sandboxed it's a managed pointer)
250
+ return cast_type ;
245
251
}
246
252
}
247
253
}
You can’t perform that action at this time.
0 commit comments