summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-06-01 01:03:00 +0200
committerVictor Stinner <victor.stinner@haypocalc.com>2011-06-01 01:03:00 +0200
commit776e69b5b37a9f0678f2759c145ed26368aaba3f (patch)
tree2f26816a6d993a0eb1afe7fc64a87674ab425860 /Lib/subprocess.py
parentd9f5292443eb3da4c56a877b7096ad001ee5d848 (diff)
downloadcpython-git-776e69b5b37a9f0678f2759c145ed26368aaba3f.tar.gz
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 3734acde33..bdf85fc108 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -707,7 +707,10 @@ class Popen(object):
def __del__(self, _maxint=sys.maxint, _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.