Skip to content

Commit 99aa8a9

Browse files
committed
Add missing native member getters.
1 parent 85470bc commit 99aa8a9

File tree

2 files changed

+18
-0
lines changed
  • graalpython

2 files changed

+18
-0
lines changed

graalpython/com.oracle.graal.python.cext/src/capi.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,21 @@ PyObject* get_tp_subclasses(PyTypeObject* obj) {
284284
return native_to_java(obj->tp_subclasses);
285285
}
286286

287+
/** to be used from Java code only; reads native 'tp_dictoffset' field */
288+
Py_ssize_t get_tp_dictoffset(PyTypeObject* obj) {
289+
return obj->tp_dictoffset;
290+
}
291+
292+
/** to be used from Java code only; reads native 'tp_itemsize' field */
293+
Py_ssize_t get_tp_itemsize(PyTypeObject* obj) {
294+
return obj->tp_itemsize;
295+
}
296+
297+
/** to be used from Java code only; reads native 'tp_basicsize' field */
298+
Py_ssize_t get_tp_basicsize(PyTypeObject* obj) {
299+
return obj->tp_basicsize;
300+
}
301+
287302
/** to be used from Java code only; returns the type ID for a byte array */
288303
polyglot_typeid get_byte_array_typeid(uint64_t len) {
289304
return polyglot_array_typeid(polyglot_i8_typeid(), len);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/NativeCAPISymbols.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public abstract class NativeCAPISymbols {
6565
public static final String FUN_GET_TP_NAME = "get_tp_name";
6666
public static final String FUN_GET_TP_MRO = "get_tp_mro";
6767
public static final String FUN_GET_TP_SUBCLASSES = "get_tp_subclasses";
68+
public static final String FUN_GET_TP_DICTOFFSET = "get_tp_dictoffset";
69+
public static final String FUN_GET_TP_BASICSIZE = "get_tp_basicsize";
70+
public static final String FUN_GET_TP_ITEMSIZE = "get_tp_itemsize";
6871
public static final String FUN_DEREF_HANDLE = "truffle_deref_handle_for_managed";
6972
public static final String FUN_GET_BYTE_ARRAY_TYPE_ID = "get_byte_array_typeid";
7073
public static final String FUN_GET_PTR_ARRAY_TYPE_ID = "get_ptr_array_typeid";

0 commit comments

Comments
 (0)