Skip to content

Commit 7dd3656

Browse files
committed
add missing specialization guards
1 parent c786f6c commit 7dd3656

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinConstructors.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Object fromString(PythonClass cls, String source, PNone encoding, PNone e
185185
throw raise(PythonErrorType.TypeError, "string argument without an encoding");
186186
}
187187

188-
@Specialization(guards = {"!isInt(iterable)", "isNoValue(encoding)", "isNoValue(errors)"})
188+
@Specialization(guards = {"!isInt(iterable)", "!isNoValue(iterable)", "isNoValue(encoding)", "isNoValue(errors)"})
189189
public Object bytearray(PythonClass cls, Object iterable, @SuppressWarnings("unused") PNone encoding, @SuppressWarnings("unused") PNone errors,
190190
@Cached("create()") GetIteratorNode getIteratorNode,
191191
@Cached("create()") GetNextNode getNextNode,
@@ -1072,7 +1072,7 @@ Object fail(PythonClass cls, Object arg, Object keywordArg) {
10721072
throw raise(TypeError, "int() can't convert non-string with explicit base");
10731073
}
10741074

1075-
@Specialization(guards = "isNoValue(keywordArg)")
1075+
@Specialization(guards = {"isNoValue(keywordArg)", "!isNoValue(obj)"})
10761076
public Object createInt(PythonClass cls, Object obj, PNone keywordArg,
10771077
@Cached("create(__INT__)") LookupAndCallUnaryNode callIntNode,
10781078
@Cached("create(__TRUNC__)") LookupAndCallUnaryNode callTruncNode,
@@ -1379,7 +1379,7 @@ public Object str(Object strClass, double arg, PNone encoding, PNone errors) {
13791379
return asPString(strClass, PFloat.doubleToString(arg));
13801380
}
13811381

1382-
@Specialization
1382+
@Specialization(guards = {"!isNoValue(obj)", "!isNone(obj)"})
13831383
public Object str(Object strClass, Object obj, @SuppressWarnings("unused") PNone encoding, @SuppressWarnings("unused") PNone errors,
13841384
@Cached("create(__STR__)") LookupAndCallUnaryNode callNode) {
13851385
Object result = callNode.executeObject(obj);

0 commit comments

Comments
 (0)