Better error message when non-dictionary received for **kwarg

This commit is contained in:
Jeremy Hylton 2001-01-25 20:13:10 +00:00
parent 619eea6821
commit a0ac40c530
1 changed files with 7 additions and 2 deletions

View File

@ -1023,8 +1023,13 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
if (keywords) {
if (!PyDict_Check(keywords)) {
PyErr_SetString(PyExc_SystemError,
"non-dictionary object received when keyword dictionary expected");
if (keywords == NULL)
PyErr_SetString(PyExc_SystemError,
"NULL received when keyword dictionary expected");
else
PyErr_Format(PyExc_SystemError,
"%s received when keyword dictionary expected",
keywords->ob_type->tp_name);
return 0;
}
kwlen = PyDict_Size(keywords);