Skip to content

Commit eae40ad

Browse files
committed
sys.exit unpacks size 1 tuple argument
1 parent e474e66 commit eae40ad

File tree

1 file changed

+6
-2
lines changed
  • graalpython/lib-graalpython

1 file changed

+6
-2
lines changed

graalpython/lib-graalpython/sys.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ def addaudithook(hook):
170170

171171

172172
@__graalpython__.builtin
173-
def exit(arg=0):
174-
raise SystemExit(arg)
173+
def exit(arg=None):
174+
# see SystemExit_init, tuple of size 1 is unpacked
175+
code = arg
176+
if isinstance(arg, tuple) and len(arg) == 1:
177+
code = arg[0]
178+
raise SystemExit(code)
175179

176180

177181
def make_excepthook():

0 commit comments

Comments
 (0)