File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
graalpython/com.oracle.graal.python.cext/src Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -226,7 +226,19 @@ PyObject* to_sulong(void *o) {
226
226
227
227
/** to be used from Java code only; reads native 'ob_type' field */
228
228
void * get_ob_type (PyObject * obj ) {
229
- return native_to_java ((PyObject * )(obj -> ob_type ));
229
+ PyTypeObject * type = obj -> ob_type ;
230
+ if (truffle_is_handle_to_managed (type )) {
231
+ return truffle_managed_from_handle (type );
232
+ } else {
233
+ // we have stored a handle to the Java class in ob_refcnt
234
+ void * handle = (void * )type -> ob_refcnt ;
235
+ if (truffle_is_handle_to_managed (handle )) {
236
+ return truffle_managed_from_handle (handle );
237
+ } else {
238
+ // assume handle is a TruffleObject
239
+ return handle ;
240
+ }
241
+ }
230
242
}
231
243
232
244
/** to be used from Java code only; returns the type ID for a byte array */
You can’t perform that action at this time.
0 commit comments