Skip to content

Commit 6a1c7fa

Browse files
committed
allow null starargs argument to MethKeywords wrappers
1 parent 954080d commit 6a1c7fa

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/ManagedMethodWrappers.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import static com.oracle.graal.python.builtins.modules.cext.PythonCextBuiltins.checkThrowableBeforeNative;
4444

45+
import com.oracle.graal.python.builtins.objects.PNone;
4546
import com.oracle.graal.python.builtins.objects.PythonAbstractObject;
4647
import com.oracle.graal.python.builtins.objects.cext.capi.CExtNodes.TransformExceptionToNativeNode;
4748
import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitions.NativeToPythonNode;
@@ -147,8 +148,13 @@ public Object execute(Object[] arguments,
147148
Object starArgs = toJavaNode.execute(arguments[1]);
148149
Object kwArgs = toJavaNode.execute(arguments[2]);
149150

150-
Object[] starArgsArray = posStarargsNode.executeWith(null, starArgs);
151-
Object[] pArgs = PythonUtils.prependArgument(receiver, starArgsArray);
151+
Object[] pArgs;
152+
if (starArgs != PNone.NO_VALUE) {
153+
Object[] starArgsArray = posStarargsNode.executeWith(null, starArgs);
154+
pArgs = PythonUtils.prependArgument(receiver, starArgsArray);
155+
} else {
156+
pArgs = new Object[]{receiver};
157+
}
152158
PKeyword[] kwArgsArray = expandKwargsNode.execute(kwArgs);
153159

154160
// execute

0 commit comments

Comments
 (0)