Skip to content

Commit d540548

Browse files
committed
Expose getset_descriptor name and type to C
1 parent c25ed81 commit d540548

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@
122122
import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
123123
import com.oracle.graal.python.builtins.objects.function.PFunction;
124124
import com.oracle.graal.python.builtins.objects.function.PKeyword;
125+
import com.oracle.graal.python.builtins.objects.getsetdescriptor.GetSetDescriptor;
125126
import com.oracle.graal.python.builtins.objects.ints.PInt;
126127
import com.oracle.graal.python.builtins.objects.memoryview.PBuffer;
127128
import com.oracle.graal.python.builtins.objects.memoryview.PMemoryView;
@@ -1030,6 +1031,18 @@ static Object doDType(PBuiltinFunction object, @SuppressWarnings("unused") Pytho
10301031
return toSulongNode.execute(enclosingType != null ? enclosingType : getNativeNullNode.execute());
10311032
}
10321033

1034+
@Specialization(guards = "eq(D_NAME, key)")
1035+
static Object doDName(GetSetDescriptor object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
1036+
@Shared("toSulongNode") @Cached ToSulongNode toSulongNode) {
1037+
return toSulongNode.execute(object.getName());
1038+
}
1039+
1040+
@Specialization(guards = "eq(D_TYPE, key)")
1041+
static Object doDType(GetSetDescriptor object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key,
1042+
@Shared("toSulongNode") @Cached ToSulongNode toSulongNode) {
1043+
return toSulongNode.execute(object.getType());
1044+
}
1045+
10331046
@Specialization(guards = "eq(D_METHOD, key)")
10341047
static Object doDMethod(PythonObject object, @SuppressWarnings("unused") PythonNativeWrapper nativeWrapper, @SuppressWarnings("unused") String key) {
10351048
return new PyMethodDefWrapper(object);

0 commit comments

Comments
 (0)