]> granicus.if.org Git - python/commitdiff
[2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case...
authorOren Milman <orenmn@gmail.com>
Fri, 15 Sep 2017 07:20:11 +0000 (10:20 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Fri, 15 Sep 2017 07:20:11 +0000 (10:20 +0300)
PC/_subprocess.c

index f73d14f57930f279b64076d02cfc9e4296fd8533..fc9aaa461132cab47fe1edcecadaf340186174d8 100644 (file)
@@ -341,9 +341,13 @@ getenvironment(PyObject* environment)
     envsize = PyMapping_Length(environment);
 
     keys = PyMapping_Keys(environment);
+    if (!keys) {
+        return NULL;
+    }
     values = PyMapping_Values(environment);
-    if (!keys || !values)
+    if (!values) {
         goto error;
+    }
 
     out = PyString_FromStringAndSize(NULL, 2048);
     if (! out)