mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
(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.
This commit is contained in:
commit
1b5b9d7434
4 changed files with 19 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue