This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eryksun, miss-islington, vstinner
Date 2020-04-01.16:54:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
sys.exit() accepts negative number and values larger than 255. I checked with strace: Python calls Linux exit_group() syscall with the value passed to sys.exit().

But then os.waitid() (waitid, not waitpid!) returns the lower 8-bits of the exit code.

In fact, the exit_group() syscall truncates the exit status:

So on Linux, an exit code is always in the range [0; 255]. For example, exit_group(-1) syscall gives an exit code of 255.
Date User Action Args
2020-04-01 16:54:17vstinnersetrecipients: + vstinner, eryksun, miss-islington
2020-04-01 16:54:17vstinnersetmessageid: <>
2020-04-01 16:54:17vstinnerlinkissue40094 messages
2020-04-01 16:54:16vstinnercreate