Skip to content

Commit 8611898

Browse files
committed
SystemExitBuiltins: fix __init__ to handle code=None
1 parent 8b7bdc2 commit 8611898

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/exception/SystemExitBuiltins.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,15 @@ public static SystemExitData create(Object code) {
9090

9191
public static SystemExitData create(PythonObjectFactory factory, Object[] args) {
9292
final SystemExitData data = new SystemExitData();
93-
if (args.length == 1) {
94-
data.setCode(args[0]);
95-
} else {
96-
data.setCode(factory.createTuple(args));
93+
switch (args.length) {
94+
case 0:
95+
data.setCode(PNone.NONE);
96+
break;
97+
case 1:
98+
data.setCode(args[0]);
99+
break;
100+
default:
101+
data.setCode(factory.createTuple(args));
97102
}
98103
return data;
99104
}

0 commit comments

Comments
 (0)