Skip to content

Commit f7c8e93

Browse files
committed
fix List builtin constructor
1 parent 11c6667 commit f7c8e93

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,18 +1444,19 @@ public boolean bool(VirtualFrame frame, Object cls, Object obj,
14441444
}
14451445

14461446
// list([iterable])
1447-
@Builtin(name = LIST, minNumOfPositionalArgs = 1, maxNumOfPositionalArgs = 2, constructsClass = PythonBuiltinClassType.PList)
1447+
@Builtin(name = LIST, minNumOfPositionalArgs = 1, takesVarArgs = true, takesVarKeywordArgs = true, constructsClass = PythonBuiltinClassType.PList)
14481448
@GenerateNodeFactory
1449-
public abstract static class ListNode extends PythonBinaryBuiltinNode {
1449+
public abstract static class ListNode extends PythonVarargsBuiltinNode {
14501450
@Specialization
1451-
protected PList constructList(LazyPythonClass cls, @SuppressWarnings("unused") Object value) {
1451+
protected PList constructList(LazyPythonClass cls, @SuppressWarnings("unused") Object[] arguments, @SuppressWarnings("unused") PKeyword[] keywords) {
14521452
return factory().createList(cls);
14531453
}
14541454

14551455
@Fallback
1456-
public PList listObject(@SuppressWarnings("unused") Object cls, Object arg) {
1456+
@SuppressWarnings("unused")
1457+
public PList listObject(Object cls, Object[] arguments, PKeyword[] keywords) {
14571458
CompilerAsserts.neverPartOfCompilation();
1458-
throw new RuntimeException("list does not support iterable object " + arg);
1459+
throw raise(PythonBuiltinClassType.TypeError, "'cls' is not a type object (%p)", cls);
14591460
}
14601461
}
14611462

0 commit comments

Comments
 (0)