summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-05-31 22:57:47 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-05-31 22:57:47 (GMT)
commit87b9bc3893bac402bd773a83ee6734507f978607 (patch)
tree11a077f4d4f36f6bbb7b5d2661c4d326e24cc8df /Lib/subprocess.py
parentee49797c8dacb886d58804e59f6431ea6f842be2 (diff)
downloadcpython-87b9bc3893bac402bd773a83ee6734507f978607.zip
cpython-87b9bc3893bac402bd773a83ee6734507f978607.tar.gz
cpython-87b9bc3893bac402bd773a83ee6734507f978607.tar.bz2
Close #12085: Fix an attribute error in subprocess.Popen destructor if the
constructor has failed, e.g. because of an undeclared keyword argument. Patch written by Oleg Oshmyan.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 28dd691..4bcf159 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -768,7 +768,10 @@ class Popen(object):
self.wait()
def __del__(self, _maxsize=sys.maxsize, _active=_active):
- if not self._child_created:
+ # If __init__ hasn't had a chance to execute (e.g. if it
+ # was passed an undeclared keyword argument), we don't
+ # have a _child_created attribute at all.
+ if not getattr(self, '_child_created', False):
# We didn't get to successfully create a child process.
return
# In case the child hasn't been waited on, check if it's done.