gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214)

This commit is contained in:
Bar Harel 2024-08-23 12:12:58 +03:00 committed by GitHub
parent a64aa47302
commit 90b6d0e0f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 38 additions and 11 deletions

View file

@ -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);