SF bug #1004669: Type returned from .keys() is not checked

This commit is contained in:
Raymond Hettinger 2004-08-07 04:55:30 +00:00
parent 61992efc4b
commit 2a7dedef9e
2 changed files with 14 additions and 0 deletions

View file

@ -1702,6 +1702,11 @@ PyObject_Dir(PyObject *arg)
}
assert(result);
if (!PyList_Check(result)) {
PyErr_SetString(PyExc_TypeError,
"Expected keys() to be a list.");
goto error;
}
if (PyList_Sort(result) != 0)
goto error;
else