mirror of
https://github.com/python/cpython.git
synced 2026-04-15 00:00:57 +00:00
gh-145876: Do not mask KeyErrors raised during dictionary unpacking in call (GH-146472)
KeyErrors raised in keys() or __getitem__() during dictionary unpacking in call (func(**mymapping)) are no longer masked by TypeError.
This commit is contained in:
parent
1af025dd22
commit
6932c3ee6a
11 changed files with 71 additions and 73 deletions
|
|
@ -2416,10 +2416,12 @@ dummy_func(
|
|||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
PyObject *dict_o = PyStackRef_AsPyObjectBorrow(dict);
|
||||
PyObject *update_o = PyStackRef_AsPyObjectBorrow(update);
|
||||
PyObject *dupkey = NULL;
|
||||
|
||||
int err = _PyDict_MergeEx(dict_o, update_o, 2);
|
||||
int err = _PyDict_MergeUniq(dict_o, update_o, &dupkey);
|
||||
if (err < 0) {
|
||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o);
|
||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o, dupkey);
|
||||
Py_XDECREF(dupkey);
|
||||
ERROR_NO_POP();
|
||||
}
|
||||
u = update;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue