mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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:
parent
d9f5292443
commit
776e69b5b3
4 changed files with 19 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue