Skip to content

Commit d422933

Browse files
committed
Add Py_get_PyTypeObject_tp_bases
1 parent 53d02ba commit d422933

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextSlotBuiltins.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,19 @@ static Object doTpVectorcallOffset(Object object, long offset,
19081908
}
19091909
}
19101910

1911+
@CApiBuiltin(ret = PyObjectBorrowed, args = {PyTypeObject}, call = Ignored)
1912+
public abstract static class Py_get_PyTypeObject_tp_bases extends CApiUnaryBuiltinNode {
1913+
1914+
@Specialization
1915+
Object doTpBases(PythonManagedClass type,
1916+
@Cached TypeNodes.GetBaseClassesNode getBaseClassesNode) {
1917+
if (type.basesTuple == null) {
1918+
type.basesTuple = factory().createTuple(getBaseClassesNode.execute(type));
1919+
}
1920+
return type.basesTuple;
1921+
}
1922+
}
1923+
19111924
@CApiBuiltin(name = "Py_get_dummy", ret = Pointer, args = {Pointer}, call = Ignored)
19121925
@CApiBuiltin(name = "Py_get_PyTypeObject_tp_setattr", ret = setattrfunc, args = {PyTypeObject}, call = Ignored)
19131926
@CApiBuiltin(name = "Py_get_PyTypeObject_tp_getattr", ret = getattrfunc, args = {PyTypeObject}, call = Ignored)
@@ -1939,7 +1952,6 @@ public Object get(@SuppressWarnings("unused") Object object) {
19391952
}
19401953
}
19411954

1942-
@CApiBuiltin(name = "Py_get_PyTypeObject_tp_bases", ret = PyObjectBorrowed, args = {PyTypeObject}, call = Ignored)
19431955
@CApiBuiltin(name = "Py_get_PyTypeObject_tp_cache", ret = PyObjectBorrowed, args = {PyTypeObject}, call = Ignored)
19441956
@CApiBuiltin(name = "Py_get_PyTypeObject_tp_weaklist", ret = PyObjectBorrowed, args = {PyTypeObject}, call = Ignored)
19451957
public abstract static class PyGetSlotDummyPyPtr extends CApiUnaryBuiltinNode {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/PythonManagedClass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public abstract class PythonManagedClass extends PythonObject implements PythonA
7878
@CompilationFinal private boolean mroInitialized = false;
7979

8080
public PTuple mroStore;
81+
public PTuple basesTuple;
8182

8283
@TruffleBoundary
8384
protected PythonManagedClass(PythonLanguage lang, Object typeClass, Shape classShape, Shape instanceShape, TruffleString name, PythonAbstractClass... baseClasses) {

0 commit comments

Comments
 (0)