diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-31 22:58:57 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-05-31 22:58:57 (GMT) |
commit | 1b5b9d7434ad3c082ec96688e8d0e7edf6b8c432 (patch) | |
tree | fbf7948bdc6d76c38441b23fc6ff3e7faf32df43 /Lib/subprocess.py | |
parent | 0bb299165344129dcdc0891233f3799ca258d4a3 (diff) | |
parent | 87b9bc3893bac402bd773a83ee6734507f978607 (diff) | |
download | cpython-1b5b9d7434ad3c082ec96688e8d0e7edf6b8c432.zip cpython-1b5b9d7434ad3c082ec96688e8d0e7edf6b8c432.tar.gz cpython-1b5b9d7434ad3c082ec96688e8d0e7edf6b8c432.tar.bz2 |
(Merge 3.2) 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 6e0cf06..49137d4 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -775,7 +775,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. |