mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214)
This commit is contained in:
parent
a64aa47302
commit
90b6d0e0f8
4 changed files with 38 additions and 11 deletions
|
@ -1213,12 +1213,8 @@ _elementtree_Element_extend_impl(ElementObject *self, PyTypeObject *cls,
|
|||
PyObject* seq;
|
||||
Py_ssize_t i;
|
||||
|
||||
seq = PySequence_Fast(elements, "");
|
||||
seq = PySequence_Fast(elements, "'elements' must be an iterable");
|
||||
if (!seq) {
|
||||
PyErr_Format(
|
||||
PyExc_TypeError,
|
||||
"expected sequence, not \"%.200s\"", Py_TYPE(elements)->tp_name
|
||||
);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1918,12 +1914,8 @@ element_ass_subscr(PyObject* self_, PyObject* item, PyObject* value)
|
|||
}
|
||||
|
||||
/* A new slice is actually being assigned */
|
||||
seq = PySequence_Fast(value, "");
|
||||
seq = PySequence_Fast(value, "assignment expects an iterable");
|
||||
if (!seq) {
|
||||
PyErr_Format(
|
||||
PyExc_TypeError,
|
||||
"expected sequence, not \"%.200s\"", Py_TYPE(value)->tp_name
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
newlen = PySequence_Fast_GET_SIZE(seq);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue