mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-36279: Ensure os.wait3() rusage is initialized (GH-15111)
Co-Authored-By: David Wilson <dw@botanicus.net>
This commit is contained in:
parent
d91d4de317
commit
682107cf45
3 changed files with 25 additions and 0 deletions
|
|
@ -7489,6 +7489,12 @@ wait_helper(pid_t pid, int status, struct rusage *ru)
|
|||
if (pid == -1)
|
||||
return posix_error();
|
||||
|
||||
// If wait succeeded but no child was ready to report status, ru will not
|
||||
// have been populated.
|
||||
if (pid == 0) {
|
||||
memset(ru, 0, sizeof(*ru));
|
||||
}
|
||||
|
||||
if (struct_rusage == NULL) {
|
||||
PyObject *m = PyImport_ImportModuleNoBlock("resource");
|
||||
if (m == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue