mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #29360: _PyStack_AsDict() doesn't check kwnames
Remove two assertions which can fail on legit code. Keyword arguments are checked later with better tests and raise a regular (TypeError) exception.
This commit is contained in:
parent
90f6332382
commit
c3858bd7c6
2 changed files with 10 additions and 8 deletions
|
@ -2413,8 +2413,7 @@ _PyStack_AsDict(PyObject **values, PyObject *kwnames)
|
|||
for (i = 0; i < nkwargs; i++) {
|
||||
PyObject *key = PyTuple_GET_ITEM(kwnames, i);
|
||||
PyObject *value = *values++;
|
||||
assert(PyUnicode_CheckExact(key));
|
||||
assert(PyDict_GetItem(kwdict, key) == NULL);
|
||||
/* If key already exists, replace it with the new value */
|
||||
if (PyDict_SetItem(kwdict, key, value)) {
|
||||
Py_DECREF(kwdict);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue