mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
subprocess now emits a ResourceWarning warning
Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning if the child process is still running.
This commit is contained in:
parent
a58e2c5c49
commit
5a48e21ff1
5 changed files with 26 additions and 2 deletions
|
@ -1006,6 +1006,9 @@ class Popen(object):
|
|||
if not self._child_created:
|
||||
# We didn't get to successfully create a child process.
|
||||
return
|
||||
if self.returncode is None:
|
||||
warnings.warn("running subprocess %r" % self, 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue