[issue40094] Add os.waitstatus_to_exitcode() function
STINNER Victor
report at bugs.python.org
Wed Apr 1 12:15:29 EDT 2020
STINNER Victor <vstinner at python.org> added the comment:
Eryk:
> The current waitpid() implementation assumes it's okay to discard the upper 8 bits of the exit status, which can lose important information.
That's a bug which is independent of this issue.
> Thus not all abnormal terminations can be identified as such. Also, nothing stops a normal termination via ExitProcess from using an NTSTATUS code.
Ok, so the current os.waitstatus_to_exitcode() design is fine. On Windows, we can just consider all exit code as a "normal" process exit code.
And there is no need to modify os.waitpid() to return a negative value for values larger than (INT_MAX >> 8). We should "just" fix os.waitstatus_to_exitcode() to accept any Python integer and simply compute "x >> 8", whereas currently the argument is casted to a C int.
I propose to fix os.waitpid() and os.waitstatus_to_exitcode() for "large" exit code on Windows in a second time.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40094>
_______________________________________
More information about the Python-bugs-list
mailing list