mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +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
ee49797c8d
commit
87b9bc3893
4 changed files with 19 additions and 1 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue