From: Oren Milman Date: Fri, 15 Sep 2017 07:20:11 +0000 (+0300) Subject: [2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case... X-Git-Tag: v2.7.15rc1~200 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7f165fe652651c32833245fc902c790a4f173fa;p=python [2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595) --- diff --git a/PC/_subprocess.c b/PC/_subprocess.c index f73d14f579..fc9aaa4611 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -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)