Issue40364
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.
Created on 2020-04-22 16:51 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 23798 | merged | vstinner, 2020-12-16 10:15 | |
| Messages (3) | |||
|---|---|---|---|
| msg367021 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2020-04-22 16:51 | |
I added os.waitstatus_to_exitcode() in bpo-40094. I propose to replace _compute_returncode() with os.waitstatus_to_exitcode() in Lib/asyncio/unix_events.py to simplify the code *and* to raise an exception if asyncio gets an unexpected wait status from os.waitpid(). There is a comment which suggest to detect when asyncio gets an unexpected status, see the last comment of: def _compute_returncode(status): if os.WIFSIGNALED(status): # The child process died because of a signal. return -os.WTERMSIG(status) elif os.WIFEXITED(status): # The child process exited (e.g sys.exit()). return os.WEXITSTATUS(status) else: # The child exited, but we don't understand its status. # This shouldn't happen, but if it does, let's just # return that status; perhaps that helps debug it. return status Replacing _compute_returncode() with os.waitstatus_to_exitcode() in Lib/asyncio/unix_events.py is trivial. The problem is to update Lib/test/test_asyncio/test_unix_events.py which uses tons of mocks on os.W*() functions (ex: os.WIFEXITED()). I'm not sure how tests should be updated. Is there someone interested to propose a PR for that? |
|||
| msg367043 - (view) | Author: Kyle Stanley (aeros) * ![]() |
Date: 2020-04-22 19:08 | |
Victor Stinner wrote: > Is there someone interested to propose a PR for that? I would be interested in looking into this, although I'm not entirely certain either as to how it should be tested at the moment. I'll have to look further into the existing ones. |
|||
| msg383150 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2020-12-16 11:11 | |
New changeset 99d28c56708bff1f442e1df5748adb2620542c61 by Victor Stinner in branch 'master': bpo-40364: asyncio uses os.waitstatus_to_exitcode() (GH-23798) https://github.com/python/cpython/commit/99d28c56708bff1f442e1df5748adb2620542c61 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:29 | admin | set | github: 84544 |
| 2020-12-16 11:11:45 | vstinner | set | status: open -> closed stage: patch review -> resolved resolution: fixed versions: + Python 3.10, - Python 3.9 |
| 2020-12-16 11:11:38 | vstinner | set | messages: + msg383150 |
| 2020-12-16 10:15:14 | vstinner | set | keywords:
+ patch stage: patch review pull_requests: + pull_request22656 |
| 2020-04-22 19:09:38 | aeros | set | assignee: aeros |
| 2020-04-22 19:08:55 | aeros | set | messages: + msg367043 |
| 2020-04-22 16:51:11 | vstinner | create | |
