summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-01-24 14:05:30 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-01-24 14:05:30 (GMT)
commitc3858bd7c6e6ef37978b8483a9fe594f29b4b2de (patch)
tree0725e4f21874d89776a14be75c9104e64617413f /Objects
parent90f6332382d616ce5a3329c1176ffa1cff27ea7e (diff)
downloadcpython-c3858bd7c6e6ef37978b8483a9fe594f29b4b2de.zip
cpython-c3858bd7c6e6ef37978b8483a9fe594f29b4b2de.tar.gz
cpython-c3858bd7c6e6ef37978b8483a9fe594f29b4b2de.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 5864032..1e394f8 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -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;