Skip to content

Commit 63b4681

Browse files
committed
Fix: allow NULL for kwnames in GraalHPyCall
1 parent bc402de commit 63b4681

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2894,7 +2894,7 @@ private static boolean isEmptyDict(Object delegate, HashingStorageLen lenNode) {
28942894
public abstract static class GraalHPyCall extends HPy5ContextFunction {
28952895

28962896
@Specialization
2897-
static Object doGeneric(GraalHPyContext hpyContext, Object callable, Object args, long lnargs, PTuple kwnames,
2897+
static Object doGeneric(GraalHPyContext hpyContext, Object callable, Object args, long lnargs, Object kwnamesObj,
28982898
@Bind("this") Node inliningTarget,
28992899
@Cached PCallHPyFunction callHelperNode,
29002900
@CachedLibrary(limit = "2") InteropLibrary lib,
@@ -2908,7 +2908,15 @@ static Object doGeneric(GraalHPyContext hpyContext, Object callable, Object args
29082908
throw raiseNode.raise(PythonBuiltinClassType.TypeError, ErrorMessages.OBJ_DOES_NOT_SUPPORT_ITEM_ASSIGMENT, 0);
29092909
}
29102910
int nargs = (int) lnargs;
2911-
int nkw = tupleSizeNode.execute(kwnames);
2911+
PTuple kwnames;
2912+
int nkw;
2913+
if (kwnamesObj instanceof PTuple) {
2914+
kwnames = (PTuple) kwnamesObj;
2915+
nkw = tupleSizeNode.execute(kwnames);
2916+
} else {
2917+
nkw = 0;
2918+
kwnames = null;
2919+
}
29122920

29132921
Object typedArgsPtr = callHelperNode.call(hpyContext, GraalHPyNativeSymbol.GRAAL_HPY_FROM_HPY_ARRAY, args, nargs + nkw);
29142922
if (!lib.hasArrayElements(typedArgsPtr)) {

0 commit comments

Comments
 (0)