Issue 33538: Remove useless check in subprocess (original) (raw)

Created on 2018-05-16 13:21 by qingyunha, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg316804 - (view) Author: TaoQingyun (qingyunha) * Date: 2018-05-16 13:21
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index bafb501fcf..4a0bb33978 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -766,7 +766,7 @@ class Popen(object): ResourceWarning, source=self) # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=_maxsize) - if self.returncode is None and _active is not None: + if self.returncode is None: # Child is still running, keep us alive until we can wait on it. _active.append(self) the `_active` is initialized with [] at the beginning of the module.
msg316806 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-16 13:42
It is reset to None at the interpreter shutdown stage. This check was added intentionally.
msg316933 - (view) Author: TaoQingyun (qingyunha) * Date: 2018-05-17 14:09
I can't find the reset code, could you give me a link? Thanks.
msg316937 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-17 14:28
It is in PyImport_Cleanup() in Python/import.c. Search PyObject_SetItem(modules, name, Py_None). If you will run Python with the -v option you will see numerous messages "# cleanup[2] removing ..." emitted on stderr.
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77719
2018-05-17 14:28:11 serhiy.storchaka set messages: +
2018-05-17 14:09:55 qingyunha set messages: +
2018-05-16 13:42:42 serhiy.storchaka set status: open -> closednosy: + serhiy.storchakamessages: + resolution: not a bugstage: resolved
2018-05-16 13:21:21 qingyunha create