Skip to content

Commit 0d9b245

Browse files
committed
Allow __delete__ for C descriptors
1 parent 35aa37b commit 0d9b245

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ PThreadState get() {
16541654
public abstract static class GetSetDescriptorNode extends PythonBuiltinNode {
16551655
@Specialization(guards = {"!isNoValue(get)", "!isNoValue(set)"})
16561656
Object call(Object get, Object set, String name, LazyPythonClass owner) {
1657-
return factory().createGetSetDescriptor(get, set, name, owner);
1657+
return factory().createGetSetDescriptor(get, set, name, owner, true);
16581658
}
16591659

16601660
@Specialization(guards = {"!isNoValue(get)", "isNoValue(set)"})
@@ -1664,7 +1664,7 @@ Object call(Object get, @SuppressWarnings("unused") PNone set, String name, Lazy
16641664

16651665
@Specialization(guards = {"isNoValue(get)", "!isNoValue(set)"})
16661666
Object call(@SuppressWarnings("unused") PNone get, Object set, String name, LazyPythonClass owner) {
1667-
return factory().createGetSetDescriptor(null, set, name, owner);
1667+
return factory().createGetSetDescriptor(null, set, name, owner, true);
16681668
}
16691669
}
16701670

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
import com.oracle.graal.python.builtins.objects.floats.PFloat;
9191
import com.oracle.graal.python.builtins.objects.function.PFunction;
9292
import com.oracle.graal.python.builtins.objects.function.PKeyword;
93+
import com.oracle.graal.python.builtins.objects.getsetdescriptor.DescriptorDeleteMarker;
9394
import com.oracle.graal.python.builtins.objects.ints.PInt;
9495
import com.oracle.graal.python.builtins.objects.module.PythonModule;
9596
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
@@ -411,6 +412,14 @@ static Object doNativeNull(@SuppressWarnings("unused") CExtContext cextContext,
411412
return object.getPtr();
412413
}
413414

415+
@Specialization
416+
static Object doDeleteMarker(@SuppressWarnings("unused") CExtContext cextContext, DescriptorDeleteMarker marker,
417+
@Cached GetNativeNullNode getNativeNullNode) {
418+
assert marker == DescriptorDeleteMarker.INSTANCE;
419+
PythonNativeNull nativeNull = (PythonNativeNull) getNativeNullNode.execute();
420+
return nativeNull.getPtr();
421+
}
422+
414423
@Specialization(guards = {"object == cachedObject", "isSpecialSingleton(cachedObject)"})
415424
static Object doSingletonCached(CExtContext cextContext, @SuppressWarnings("unused") PythonAbstractObject object,
416425
@Cached("object") PythonAbstractObject cachedObject,

0 commit comments

Comments
 (0)