[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-22 Thread STINNER Victor
STINNER Victor added the comment: The initial issue has been implemented: I added os.waitstatus_to_exitcode() function to Python 3.9. It's now well documented, I close the issue. See sub-issues like bpo-40364 (asyncio) for further cleanups. -- resolution: -> fixed stage: patch revie

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-22 Thread STINNER Victor
STINNER Victor added the comment: """ TODO: * Decide if subprocess should reject WIFSTOPPED() or not. * Check if the pure Python implementation of os._spawnvef() handles WIFSTOPPED() properly. """ Well, let's keep the status quo: leave os and subprocess modules unchanged. It can be revisited

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-22 Thread STINNER Victor
STINNER Victor added the comment: > TODO: Modify asyncio.unix_events._compute_returncode() to use > waitstatus_to_exitcode(): need to update tests. I created bpo-40364 for that. -- ___ Python tracker _

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-02 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- nosy: +BTaskaya ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-02 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-40155: "AIX: test_builtin.test_input_no_stdout_fileno() hangs". -- ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset e7c98f08e228e9f6e139d61e3e5d0a5018a38f0b by Victor Stinner in branch 'master': bpo-40094: Fix which.py script exit code (GH-19286) https://github.com/python/cpython/commit/e7c98f08e228e9f6e139d61e3e5d0a5018a38f0b -- __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset 9a679a0e47d58aa73b7747d4e16140048c10baf5 by Victor Stinner in branch 'master': bpo-40094: CGIHTTPRequestHandler logs exit code (GH-19285) https://github.com/python/cpython/commit/9a679a0e47d58aa73b7747d4e16140048c10baf5 -- ___

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset d57cf557366584539f400db523b555296487e8f5 by Victor Stinner in branch 'master': bpo-40094: mailcap.test() uses waitstatus_to_exitcode() (GH-19287) https://github.com/python/cpython/commit/d57cf557366584539f400db523b555296487e8f5 -- ___

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: > Decide if subprocess should reject WIFSTOPPED() or not. This code path was added by bpo-29335. -- ___ Python tracker ___ _

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset c8dd641b6214bdcf794bab469a51da6843feb770 by Miss Islington (bot) in branch '3.7': bpo-40094: Enhance os.WIFEXITED documentation (GH-19244) (GH-19278) https://github.com/python/cpython/commit/c8dd641b6214bdcf794bab469a51da6843feb770 --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18646 pull_request: https://github.com/python/cpython/pull/19287 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset 267afc2ab2014e1e3c6b2ff088350a69b691a544 by Miss Islington (bot) in branch '3.8': bpo-40094: Enhance os.WIFEXITED documentation (GH-19244) (GH-19277) https://github.com/python/cpython/commit/267afc2ab2014e1e3c6b2ff088350a69b691a544 --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18645 pull_request: https://github.com/python/cpython/pull/19286 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: See also: "Appendix E. Exit Codes With Special Meanings" section of the Bash documentation https://tldp.org/LDP/abs/html/exitcodes.html -- ___ Python tracker __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18643 pull_request: https://github.com/python/cpython/pull/19285 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: TODO: * Modify asyncio.unix_events._compute_returncode() to use waitstatus_to_exitcode(): need to update tests. * Modify run_cgi() of http.server to log the exit code rather the exit status: use waitstatus_to_exitcode(). * Modify Tools/scripts/which.py to lo

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: 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 fac

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset 65a796e5272f61b42792d3a8c69686558c1872c5 by Victor Stinner in branch 'master': bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201) https://github.com/python/cpython/commit/65a796e5272f61b42792d3a8c69686558c1872c5 --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor 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

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor
STINNER Victor added the comment: New changeset 7c72383f95b0cdedf390726069428d7b69ed2597 by Victor Stinner in branch 'master': bpo-40094: Enhance os.WIFEXITED documentation (GH-19244) https://github.com/python/cpython/commit/7c72383f95b0cdedf390726069428d7b69ed2597 -- _

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 2.0 -> 3.0 pull_requests: +18633 pull_request: https://github.com/python/cpython/pull/19277 ___ Python tracker _

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread miss-islington
Change by miss-islington : -- pull_requests: +18634 pull_request: https://github.com/python/cpython/pull/19278 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread Eryk Sun
Eryk Sun added the comment: > It's more the opposite, if tomorrow we want to encode the status > of a terminated process differently, it will be easier if > os.waitstatus_to_exitcode() is available, no? This new status-to-exitcode function applies to Windows waitpid() only due to a design c

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset afeaea2d6e346f627b24cc9e84e2986a7266a70e by Victor Stinner in branch 'master': bpo-40094: Add missing import to wait_process() (GH-19268) https://github.com/python/cpython/commit/afeaea2d6e346f627b24cc9e84e2986a7266a70e -- ___

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18625 pull_request: https://github.com/python/cpython/pull/19268 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 6b982c22e5fdbfecc24e440515b63f7253f695c4 by Victor Stinner in branch 'master': bpo-40094: Add run_command() to setup.py (GH-19266) https://github.com/python/cpython/commit/6b982c22e5fdbfecc24e440515b63f7253f695c4 -- __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 16d75675d2ad2454f6dfbf333c94e6237df36018 by Victor Stinner in branch 'master': bpo-31160: Fix race condition in test_os.PtyTests (GH-19263) https://github.com/python/cpython/commit/16d75675d2ad2454f6dfbf333c94e6237df36018 -- _

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18623 pull_request: https://github.com/python/cpython/pull/19266 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 40bfdb1594189f3c0238e5d2098dc3abf114e200 by Victor Stinner in branch 'master': bpo-40094: Add _bootsubprocess._waitstatus_to_exitcode (GH-19264) https://github.com/python/cpython/commit/40bfdb1594189f3c0238e5d2098dc3abf114e200 --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18621 pull_request: https://github.com/python/cpython/pull/19264 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18620 pull_request: https://github.com/python/cpython/pull/19263 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset a9f9687a7ce25e7c0c89f88f52db323104668ae0 by Victor Stinner in branch 'master': bpo-40094: Enhance threading tests (GH-19260) https://github.com/python/cpython/commit/a9f9687a7ce25e7c0c89f88f52db323104668ae0 --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 27c6231f5827fe17c6cb6f097391931f30b511ec by Victor Stinner in branch 'master': bpo-40094: Enhance fork and wait tests (GH-19259) https://github.com/python/cpython/commit/27c6231f5827fe17c6cb6f097391931f30b511ec --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18616 pull_request: https://github.com/python/cpython/pull/19260 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18615 pull_request: https://github.com/python/cpython/pull/19259 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: New changeset 278c1e159c970da6cd6683d18c6211f5118674cc by Victor Stinner in branch 'master': bpo-40094: Add test.support.wait_process() (GH-19254) https://github.com/python/cpython/commit/278c1e159c970da6cd6683d18c6211f5118674cc --

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
STINNER Victor added the comment: Eryk: > FWIW, I wouldn't recommend relying on os.waitpid to get the correct process > exit status in Windows. Status codes are 32 bits and generally all bits are > required. os.waitpid left shifts the exit status by 8 bits in a dubious > attempt to return a

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18612 pull_request: https://github.com/python/cpython/pull/19254 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread Eryk Sun
Eryk Sun added the comment: > On Windows, os.waitpid() status also requires an operation (shif > right by 8 bits) to get an exitcode from the waitpid status. FWIW, I wouldn't recommend relying on os.waitpid to get the correct process exit status in Windows. Status codes are 32 bits and gene

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-31 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +18603 pull_request: https://github.com/python/cpython/pull/19244 ___ Python tracker ___ __

[issue40094] Add os.waitstatus_to_exitcode() function

2020-03-30 Thread STINNER Victor
STINNER Victor added the comment: Ok, I chose os.waitstatus_to_exitcode() name. I updated my PR. -- title: Add os.status_to_exitcode() function -> Add os.waitstatus_to_exitcode() function ___ Python tracker ___