diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-09-14 19:56:31 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-09-14 19:56:31 (GMT) |
commit | f135f62cfd1529cbb9326e53728a22afd05b6bc3 (patch) | |
tree | 069cd5e8e3cba9b6f207d837cba76621128ff29e /Modules | |
parent | 20fa05d0223101b8e0005525b94a2eac892348de (diff) | |
download | cpython-f135f62cfd1529cbb9326e53728a22afd05b6bc3.zip cpython-f135f62cfd1529cbb9326e53728a22afd05b6bc3.tar.gz cpython-f135f62cfd1529cbb9326e53728a22afd05b6bc3.tar.bz2 |
[3.6] bpo-31471: Fix assertion failure in subprocess.Popen() on Windows, in case env has a bad keys() method. (GH-3580) (#3584)
(cherry picked from commit 0b3a87ef54a0112b74e8a1d8c6f87d10db4239ab)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_winapi.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/_winapi.c b/Modules/_winapi.c index 1606f0d..b98e778 100644 --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -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) { |