bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (#3580)

This commit is contained in:
Oren Milman 2017-09-14 22:30:28 +03:00 committed by Serhiy Storchaka
parent f350a268a7
commit 0b3a87ef54
3 changed files with 16 additions and 1 deletions

View file

@ -723,9 +723,13 @@ getenvironment(PyObject* environment)
}
keys = PyMapping_Keys(environment);
if (!keys) {
return NULL;
}
values = PyMapping_Values(environment);
if (!keys || !values)
if (!values) {
goto error;
}
envsize = PySequence_Fast_GET_SIZE(keys);
if (PySequence_Fast_GET_SIZE(values) != envsize) {