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 jmarshall
Recipients docs@python, jmarshall
Date 2021-10-21.13:05:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1634821512.68.0.19757436473.issue45554@roundup.psfhosted.org>
In-reply-to
Content
<https://docs.python.org/3.11/library/multiprocessing.html#multiprocessing.Process.exitcode> describes exitcode as

"The child’s exit code. This will be None if the process has not yet terminated. A negative value -N indicates that the child was terminated by signal N."

and similarly in earlier documentation versions.

This does not describe what the exit code will be under normal circumstances, or if the child abends by raising a Python exception.

By examination of BaseProcess._bootstrap() it can be determined that the current behaviour appears to be:

* even if your subclass overrides the run() method, whatever this method returns is ignored (and in particular the return value has no effect on the child's exit code);

* if the run() method returns normally, the child's exit code will be 0;

* if the run() method raises SystemExit (or, I guess, calls sys.exit()) with an integer exit status, that exit status will be propagated to the child's exit code;

* if the run() method raises any other exception, the exception traceback will be printed to stderr and the child's exit code will be 1.


However I did not see a way to figure these details out from the documentation, and it is unclear whether all these details are supported behaviours.
History
Date User Action Args
2021-10-21 13:05:12jmarshallsetrecipients: + jmarshall, docs@python
2021-10-21 13:05:12jmarshallsetmessageid: <1634821512.68.0.19757436473.issue45554@roundup.psfhosted.org>
2021-10-21 13:05:12jmarshalllinkissue45554 messages
2021-10-21 13:05:12jmarshallcreate