mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-116436: Improve error message when TypeError occurs during dict update (#116443)
This commit is contained in:
parent
4e294f6feb
commit
7e8b153fef
3 changed files with 31 additions and 4 deletions
|
|
@ -3730,13 +3730,14 @@ merge_from_seq2_lock_held(PyObject *d, PyObject *seq2, int override)
|
|||
}
|
||||
|
||||
/* Convert item to sequence, and verify length 2. */
|
||||
fast = PySequence_Fast(item, "");
|
||||
fast = PySequence_Fast(item, "object is not iterable");
|
||||
if (fast == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_TypeError))
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"cannot convert dictionary update "
|
||||
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
|
||||
_PyErr_FormatNote(
|
||||
"Cannot convert dictionary update "
|
||||
"sequence element #%zd to a sequence",
|
||||
i);
|
||||
}
|
||||
goto Fail;
|
||||
}
|
||||
n = PySequence_Fast_GET_SIZE(fast);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue