mirror of
https://github.com/python/cpython.git
synced 2025-10-04 06:06:44 +00:00
Better error message when non-dictionary received for **kwarg
This commit is contained in:
parent
619eea6821
commit
a0ac40c530
1 changed files with 7 additions and 2 deletions
|
@ -1023,8 +1023,13 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
|
||||||
|
|
||||||
if (keywords) {
|
if (keywords) {
|
||||||
if (!PyDict_Check(keywords)) {
|
if (!PyDict_Check(keywords)) {
|
||||||
|
if (keywords == NULL)
|
||||||
PyErr_SetString(PyExc_SystemError,
|
PyErr_SetString(PyExc_SystemError,
|
||||||
"non-dictionary object received when keyword dictionary expected");
|
"NULL received when keyword dictionary expected");
|
||||||
|
else
|
||||||
|
PyErr_Format(PyExc_SystemError,
|
||||||
|
"%s received when keyword dictionary expected",
|
||||||
|
keywords->ob_type->tp_name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
kwlen = PyDict_Size(keywords);
|
kwlen = PyDict_Size(keywords);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue