[Python-checkins] [2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595)
Serhiy Storchaka
webhook-mailer at python.org
Fri Sep 15 03:20:13 EDT 2017
https://github.com/python/cpython/commit/c7f165fe652651c32833245fc902c790a4f173fa
commit: c7f165fe652651c32833245fc902c790a4f173fa
branch: 2.7
author: Oren Milman <orenmn at gmail.com>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2017-09-15T10:20:11+03:00
summary:
[2.7] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3595)
files:
M PC/_subprocess.c
diff --git a/PC/_subprocess.c b/PC/_subprocess.c
index f73d14f5793..fc9aaa46113 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)
More information about the Python-checkins
mailing list