diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-01 01:03:00 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-06-01 01:03:00 +0200 |
commit | 776e69b5b37a9f0678f2759c145ed26368aaba3f (patch) | |
tree | 2f26816a6d993a0eb1afe7fc64a87674ab425860 /Lib/subprocess.py | |
parent | d9f5292443eb3da4c56a877b7096ad001ee5d848 (diff) | |
download | cpython-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.py | 5 |
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. |