mirror of
https://github.com/python/cpython.git
synced 2026-04-17 09:20:43 +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
6
Python/executor_cases.c.h
generated
6
Python/executor_cases.c.h
generated
|
|
@ -9458,15 +9458,17 @@
|
|||
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
|
||||
PyObject *dict_o = PyStackRef_AsPyObjectBorrow(dict);
|
||||
PyObject *update_o = PyStackRef_AsPyObjectBorrow(update);
|
||||
PyObject *dupkey = NULL;
|
||||
stack_pointer[0] = update;
|
||||
stack_pointer += 1;
|
||||
ASSERT_WITHIN_STACK_BOUNDS(__FILE__, __LINE__);
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
int err = _PyDict_MergeEx(dict_o, update_o, 2);
|
||||
int err = _PyDict_MergeUniq(dict_o, update_o, &dupkey);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
if (err < 0) {
|
||||
_PyFrame_SetStackPointer(frame, stack_pointer);
|
||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o);
|
||||
_PyEval_FormatKwargsError(tstate, callable_o, update_o, dupkey);
|
||||
Py_XDECREF(dupkey);
|
||||
stack_pointer = _PyFrame_GetStackPointer(frame);
|
||||
SET_CURRENT_CACHED_VALUES(0);
|
||||
JUMP_TO_ERROR();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue