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.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 3734acd..bdf85fc 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -707,7 +707,10 @@
 
 
     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.