diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-31 22:57:47 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-31 22:57:47 (GMT) |
commit | 87b9bc3893bac402bd773a83ee6734507f978607 (patch) | |
tree | 11a077f4d4f36f6bbb7b5d2661c4d326e24cc8df /Lib/subprocess.py | |
parent | ee49797c8dacb886d58804e59f6431ea6f842be2 (diff) | |
download | cpython-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.py | 5 |
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. |