diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-22 15:57:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 15:57:59 (GMT) |
commit | b07350901cac9197aef41855d8a4d56533636b91 (patch) | |
tree | b9ab42158db0cea7b537f8dc3e23d9f8ec2bedba /Modules/posixmodule.c | |
parent | 3a5545025685040842420c85a4a9aab5f044aeb8 (diff) | |
download | cpython-b07350901cac9197aef41855d8a4d56533636b91.zip cpython-b07350901cac9197aef41855d8a4d56533636b91.tar.gz cpython-b07350901cac9197aef41855d8a4d56533636b91.tar.bz2 |
bpo-40138: Fix Windows os.waitpid() for large exit code (GH-19654)
Fix the Windows implementation of os.waitpid() for exit code
larger than "INT_MAX >> 8". The exit status is now interpreted as an
unsigned number.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d40827d..eb0b56a 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -7867,8 +7867,10 @@ os_waitpid_impl(PyObject *module, intptr_t pid, int options) if (res < 0) return (!async_err) ? posix_error() : NULL; + unsigned long long ustatus = (unsigned int)status; + /* shift the status left a byte so this is more like the POSIX waitpid */ - return Py_BuildValue(_Py_PARSE_INTPTR "i", res, status << 8); + return Py_BuildValue(_Py_PARSE_INTPTR "K", res, ustatus << 8); } #endif |