Skip to content

Commit 8b67e97

Browse files
committed
Implement message resolution for d_name and d_type of PyMethodDescrObject
1 parent 3b917e8 commit 8b67e97

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,20 @@ static Object doDGetSet(PythonObject object, @SuppressWarnings("unused") PythonN
887887
return new PyGetSetDefWrapper(object);
888888
}
889889

890+
@Specialization(guards = "eq(D_NAME, key)")
891+
static Object doDName(PBuiltinFunction object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
892+
@Shared("toSulongNode") @Cached ToSulongNode toSulongNode) {
893+
return toSulongNode.execute(object.getName());
894+
}
895+
896+
@Specialization(guards = "eq(D_TYPE, key)")
897+
static Object doDType(PBuiltinFunction object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
898+
@Cached GetNativeNullNode getNativeNullNode,
899+
@Shared("toSulongNode") @Cached ToSulongNode toSulongNode) {
900+
Object enclosingType = object.getEnclosingType();
901+
return toSulongNode.execute(enclosingType != null ? enclosingType : getNativeNullNode.execute());
902+
}
903+
890904
@Specialization(guards = "eq(D_METHOD, key)")
891905
static Object doDBase(PythonObject object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key) {
892906
return new PyMethodDefWrapper(object);

0 commit comments

Comments
 (0)