From b03142782c84c3ce6ba0a86a3af93c08b84f32e6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 14 Nov 2013 21:37:05 +0100 Subject: [PATCH] Issue #19437: Fix parse_envlist() of the posix/nt module, don't call PyMapping_Values() with an exception set, exit immediatly on error. --- Modules/posixmodule.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 5e5f35520c..7e6bdc8879 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -5083,8 +5083,10 @@ parse_envlist(PyObject* env, Py_ssize_t *envc_ptr) } envc = 0; keys = PyMapping_Keys(env); + if (!keys) + goto error; vals = PyMapping_Values(env); - if (!keys || !vals) + if (!vals) goto error; if (!PyList_Check(keys) || !PyList_Check(vals)) { PyErr_Format(PyExc_TypeError, -- 2.50.0