Skip to content

Commit 53cd490

Browse files
committed
Implement DebugHandle._force_close
1 parent ae2878f commit 53cd490

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
@@ -47,6 +47,7 @@
4747
import com.oracle.graal.python.builtins.CoreFunctions;
4848
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
4949
import com.oracle.graal.python.builtins.PythonBuiltins;
50+
import com.oracle.graal.python.builtins.objects.PNone;
5051
import com.oracle.graal.python.builtins.objects.PNotImplemented;
5152
import com.oracle.graal.python.nodes.SpecialMethodNames;
5253
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode.LookupAndCallUnaryDynamicNode;
@@ -150,4 +151,15 @@ private static Object format(GraalHPyDebugContext hpyDebugContext, PDebugHandle
150151
return String.format("<DebugHandle 0x%s for %s>", Integer.toHexString(id), reprStr);
151152
}
152153
}
154+
155+
@Builtin(name = "_force_close", minNumOfPositionalArgs = 1, doc = "Close the underlying handle. FOR TESTS ONLY.")
156+
@GenerateNodeFactory
157+
public abstract static class HPyDebugHandleForceCloseNode extends PythonUnaryBuiltinNode {
158+
159+
@Specialization
160+
PNone doGeneric(PDebugHandle self) {
161+
self.getHandle().close(getContext().getHPyContext(), ConditionProfile.getUncached());
162+
return PNone.NONE;
163+
}
164+
}
153165
}

0 commit comments

Comments
 (0)