summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-05-20 10:11:15 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-05-20 10:11:15 (GMT)
commit5a48e21ff163107a6f1788050b2f1ffc8bce2b6d (patch)
tree47b255b5bd985c762fe5fd2bb9e0beb828fdb986 /Lib/subprocess.py
parenta58e2c5c4928ae8031ee60a97f2ab4f863aff8cb (diff)
downloadcpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.zip
cpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.tar.gz
cpython-5a48e21ff163107a6f1788050b2f1ffc8bce2b6d.tar.bz2
subprocess now emits a ResourceWarning warning
Issue #26741: subprocess.Popen destructor now emits a ResourceWarning warning if the child process is still running.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 41a9de1..b853f4d 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -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: