_PyStack_AsDict() now checks kwnames != NULL

Issue #29259.
This commit is contained in:
Victor Stinner 2017-01-18 18:06:32 +01:00
parent c75340a8fd
commit 06d34393c2
1 changed files with 3 additions and 1 deletions

View File

@ -2399,10 +2399,12 @@ _PyObject_Call_Prepend(PyObject *callable,
PyObject *
_PyStack_AsDict(PyObject **values, PyObject *kwnames)
{
Py_ssize_t nkwargs = PyTuple_GET_SIZE(kwnames);
Py_ssize_t nkwargs;
PyObject *kwdict;
Py_ssize_t i;
assert(kwnames != NULL);
nkwargs = PyTuple_GET_SIZE(kwnames);
kwdict = _PyDict_NewPresized(nkwargs);
if (kwdict == NULL) {
return NULL;