[issue14376] sys.exit documents argument as "integer" but actually requires "subtype of int"

Mark Dickinson report at bugs.python.org
Wed Mar 21 09:27:16 CET 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

> It would be simple to change line 1112 of pythonrun.c from
>
>    if (PyInt_Check(value))
>
> to
>
>    if (PyInt_Check(value) || PyLong_Check(value))

Wouldn't you also have to deal with possible errors from the PyInt_AsLong call?  E.g., after sys.exit(2**64), an OverflowException would be set.  I don't know if not dealing with that exception (perhaps with PyErr_Clear) before exit might cause issues, though it seems to work in practice (with the -1 value indicating an error being turned into an exit code of 255).

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14376>
_______________________________________


More information about the Python-bugs-list mailing list