Skip to content

Commit d207111

Browse files
committed
fix resetting the on_invalid_handle callback
1 parent 23a4da9 commit d207111

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,13 @@ abstract static class HPyDebugSetOnInvalidHandleNode extends PythonUnaryBuiltinN
234234
PNone doInt(VirtualFrame frame, Object callback,
235235
@Cached PyCallableCheckNode callableCheckNode) {
236236
GraalHPyDebugContext hpyDebugContext = getHPyDebugContext(frame, getLanguage(), this);
237-
if (!callableCheckNode.execute(callback)) {
237+
if (callback == PNone.NONE) {
238+
hpyDebugContext.setOnInvalidHandleCallback(null);
239+
} else if (!callableCheckNode.execute(callback)) {
238240
throw raise(TypeError, "Expected a callable object");
241+
} else {
242+
hpyDebugContext.setOnInvalidHandleCallback(callback);
239243
}
240-
hpyDebugContext.setOnInvalidHandleCallback(callback);
241244
return PNone.NONE;
242245
}
243246
}

0 commit comments

Comments
 (0)