Skip to content

Commit 8254b31

Browse files
committed
Define Py_GenericAliasType
1 parent b16cdea commit 8254b31

File tree

2 files changed

+6
-1
lines changed
  • graalpython

2 files changed

+6
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ PY_TRUFFLE_TYPE(UnionType_Type, "_ctypes.UnionType", &PyType_Type, sizeof(PyO
342342
PY_TRUFFLE_TYPE(PyCPointerType_Type, "PyCPointerType", &PyType_Type, sizeof(PyObject)) \
343343
PY_TRUFFLE_TYPE(PyCArrayType_Type, "PyCArrayType", &PyType_Type, sizeof(PyObject)) \
344344
PY_TRUFFLE_TYPE(PyCoro_Type, "coroutine", &PyType_Type, sizeof(PyCoroObject)) \
345+
PY_TRUFFLE_TYPE(Py_GenericAliasType, "types.GenericAlias", &PyType_Type, sizeof(PyObject)) \
345346
/* PyPickleBufferObject (PyObject_HEAD + Py_buffer + PyObject*) is defined within Objects/picklebufobject.c, so its not exposed. */ \
346347
PY_TRUFFLE_TYPE(PyPickleBuffer_Type, "_pickle.PickleBuffer", &PyType_Type, sizeof(PyPickleBufferObject)) \
347348
PY_TRUFFLE_TYPE_UNIMPLEMENTED(_PyAIterWrapper_Type) \

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1705,7 +1705,11 @@ private static PythonManagedClass lookupBuiltinTypeWithName(PythonContext contex
17051705
}
17061706
Object attribute = PyObjectGetAttr.getUncached().execute(null, moduleObject, toTruffleStringUncached(name));
17071707
if (attribute != PNone.NO_VALUE) {
1708-
clazz = (PythonManagedClass) attribute;
1708+
if (attribute instanceof PythonBuiltinClassType builtinType) {
1709+
clazz = core.lookupType(builtinType);
1710+
} else {
1711+
clazz = (PythonManagedClass) attribute;
1712+
}
17091713
}
17101714

17111715
}

0 commit comments

Comments
 (0)