Skip to content

Commit 32382a8

Browse files
committed
fix parsing optional tuple unpacking argument
1 parent dce92da commit 32382a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtParseArgumentsNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
8080
import com.oracle.graal.python.runtime.PythonContext;
8181
import com.oracle.graal.python.runtime.exception.PException;
82+
import com.oracle.graal.python.runtime.object.PythonObjectFactory;
8283
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
8384
import com.oracle.truffle.api.CompilerAsserts;
8485
import com.oracle.truffle.api.CompilerDirectives;
@@ -961,12 +962,13 @@ static ParserState doPredicate(ParserState state, Object kwds, @SuppressWarnings
961962
@Specialization(guards = "c == FORMAT_PAR_OPEN")
962963
static ParserState doPredicate(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
963964
Object kwdnames, @SuppressWarnings("unused") Object varargs,
965+
@Cached PythonObjectFactory factory,
964966
@Shared("getArgNode") @Cached GetArgNode getArgNode,
965967
@Shared("raiseNode") @Cached PRaiseNativeNode raiseNode) throws InteropException, ParseArgumentsException {
966968

967969
Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);
968970
if (skipOptionalArg(arg, state.restOptional)) {
969-
return state.incrementOutIndex();
971+
return state.open(new PositionalArgStack(factory.createEmptyTuple(), state.v));
970972
} else {
971973
// n.b.: there is a small gap in this check: In theory, there could be
972974
// native subclass of tuple. But since we do not support this anyway, the

0 commit comments

Comments
 (0)