Skip to content

Commit 49d3dce

Browse files
committed
KeywordArgumentsNode: fix non mapping case
1 parent 31f79d2 commit 49d3dce

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/argument/keywords/KeywordArgumentsNode.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,17 @@ PKeyword[] doDict(PKeyword[] arguments, PDict starargs,
9393
return internalNode.execute(arguments, starArgs);
9494
}
9595

96-
@Specialization
96+
protected boolean isNonMapping(PKeyword[] arguments, Object starargs) {
97+
return (arguments.length == 0 && PGuards.isPNone(starargs)) ||
98+
(!PGuards.isDict(starargs) && !PGuards.isPNone(starargs));
99+
}
100+
101+
@Specialization(guards = "arguments.length > 0")
97102
PKeyword[] doNone(PKeyword[] arguments, @SuppressWarnings("unused") PNone starargs) {
98103
return arguments;
99104
}
100105

101-
@Specialization(guards = {"!isDict(starargs)", "!isPNone(starargs)"})
106+
@Specialization(guards = "isNonMapping(arguments, starargs)")
102107
PKeyword[] doGeneral(@SuppressWarnings("unused") PKeyword[] arguments, Object starargs) {
103108
throw new NonMappingException(starargs);
104109
}

0 commit comments

Comments
 (0)