Skip to content

Commit ae2878f

Browse files
committed
Implement DebugHandle.is_closed
1 parent 114820f commit ae2878f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ Object doGeneric(PDebugHandle self,
9494
}
9595
}
9696

97+
@Builtin(name = "is_closed", minNumOfPositionalArgs = 1, isGetter = true, //
98+
doc = "Self-explanatory")
99+
@GenerateNodeFactory
100+
public abstract static class HPyDebugHandleIsClosedNode extends PythonUnaryBuiltinNode {
101+
102+
@Specialization
103+
static boolean doGeneric(PDebugHandle self) {
104+
GraalHPyHandle handle = self.getHandle();
105+
return !handle.isPointer(ConditionProfile.getUncached());
106+
}
107+
}
108+
97109
@Builtin(name = SpecialMethodNames.__EQ__, minNumOfPositionalArgs = 2)
98110
@GenerateNodeFactory
99111
public abstract static class HPyDebugHandleEqNode extends PythonBinaryBuiltinNode {

0 commit comments

Comments
 (0)