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 chrahunt
Recipients chrahunt, davin, eamanu
Date 2019-09-13.23:17:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568416646.43.0.38554699783.issue35727@roundup.psfhosted.org>
In-reply-to
Content
> I believe the mentality behind multiprocessing.Process triggering an exit code of 1 when sys.exit() is invoked inside its process is to indicate a non-standard exit out of its execution.

Can I ask what this is based on? I did a pretty good amount of digging but didn't find any justification for it. It just seems like a simple oversight to me.

> There may yet be other side effects that could be triggered by having a sys.exit(0) translate into an exit code of 0 from the Process's process -- and we might not notice them with the current tests.

This is definitely a behavior change and will break any code that currently relies on `sys.exit(None)` or `sys.exit()` exiting with a non-zero exit code from a multiprocessing.Process. The fact that all documentation indicates that `sys.exit(None)` or `sys.exit()` results in a 0 exit code in normal Python (with no documentation on it related to multiprocessing) makes me think that any code relying on this behavior is subtly broken, however. Any impacted user can update their code and explicitly pass 1 to `sys.exit`, which should be forward and backwards compatible.

> Was there a particular use case that motivates this suggested change?

I have a wrapper library that invokes arbitrary user code and attempts to behave as if that code was executed in a vanilla Python process, to include propagating the correct exit code.

Currently I have a workaround here: https://github.com/chrahunt/quicken/blob/2dd00a5f024d7b114b211aad8a2618ec8f101956/quicken/_internal/server.py#L344-L353, but it would be nice to get rid of it in 5-6 years if this fix gets in and the non-conformant Python versions fall out of support. :)
History
Date User Action Args
2019-09-13 23:17:26chrahuntsetrecipients: + chrahunt, davin, eamanu
2019-09-13 23:17:26chrahuntsetmessageid: <1568416646.43.0.38554699783.issue35727@roundup.psfhosted.org>
2019-09-13 23:17:26chrahuntlinkissue35727 messages
2019-09-13 23:17:26chrahuntcreate