diff options
author | Oren Milman <orenmn@gmail.com> | 2017-09-15 07:20:11 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-15 07:20:11 (GMT) |
commit | c7f165fe652651c32833245fc902c790a4f173fa (patch) | |
tree | 8082204f2fca451d16ffba87e18c18562f69d8c0 /PC | |
parent | a72d15c97f9837f6c9c6bd476a62175c942cc588 (diff) | |
download | cpython-c7f165fe652651c32833245fc902c790a4f173fa.zip cpython-c7f165fe652651c32833245fc902c790a4f173fa.tar.gz cpython-c7f165fe652651c32833245fc902c790a4f173fa.tar.bz2 |
[2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595)
Diffstat (limited to 'PC')
-rw-r--r-- | PC/_subprocess.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/PC/_subprocess.c b/PC/_subprocess.c index f73d14f..fc9aaa4 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) |