Skip to content

Commit 67741d9

Browse files
committed
Fix C argument parser "p" format not working
1 parent 00ead38 commit 67741d9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
import com.oracle.graal.python.builtins.objects.tuple.PTuple;
7777
import com.oracle.graal.python.nodes.ErrorMessages;
7878
import com.oracle.graal.python.nodes.PGuards;
79-
import com.oracle.graal.python.nodes.SpecialMethodNames;
80-
import com.oracle.graal.python.nodes.call.special.LookupAndCallUnaryNode.LookupAndCallUnaryDynamicNode;
8179
import com.oracle.graal.python.nodes.classes.IsSubtypeNode;
8280
import com.oracle.graal.python.nodes.object.IsBuiltinClassProfile;
8381
import com.oracle.graal.python.runtime.PythonContext;
@@ -949,12 +947,12 @@ private static int intValue(Number rc) {
949947
static ParserState doPredicate(ParserState state, Object kwds, @SuppressWarnings("unused") char c, @SuppressWarnings("unused") char[] format, @SuppressWarnings("unused") int format_idx,
950948
Object kwdnames, Object varargs,
951949
@Shared("getArgNode") @Cached GetArgNode getArgNode,
952-
@Shared("writeOutVarNode") @Cached WriteOutVarNode writeOutVarNode) throws InteropException, ParseArgumentsException {
950+
@Shared("writeOutVarNode") @Cached WriteOutVarNode writeOutVarNode,
951+
@CachedLibrary(limit = "3") PythonObjectLibrary lib) throws InteropException, ParseArgumentsException {
953952

954953
Object arg = getArgNode.execute(state, kwds, kwdnames, state.restKeywordsOnly);
955954
if (!skipOptionalArg(arg, state.restOptional)) {
956-
// TODO(fa) refactor 'CastToBooleanNode' to provide uncached version and use it
957-
writeOutVarNode.writeInt32(varargs, state.outIndex, LookupAndCallUnaryDynamicNode.getUncached().executeObject(arg, SpecialMethodNames.__BOOL__));
955+
writeOutVarNode.writeInt32(varargs, state.outIndex, lib.isTrue(arg) ? 1 : 0);
958956
}
959957
return state.incrementOutIndex();
960958
}

0 commit comments

Comments
 (0)