summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorBar Harel <bharel@barharel.com>2024-08-23 09:12:58 (GMT)
committerGitHub <noreply@github.com>2024-08-23 09:12:58 (GMT)
commit90b6d0e0f8f07d7443695e14a18488cb499d3b4d (patch)
tree9ff1d44bc97694e340ab622bedcc5f69dfa73f18 /Modules/_elementtree.c
parenta64aa47302bad05c4cd2e98d54e39a33722bf54f (diff)
downloadcpython-90b6d0e0f8f07d7443695e14a18488cb499d3b4d.zip
cpython-90b6d0e0f8f07d7443695e14a18488cb499d3b4d.tar.gz
cpython-90b6d0e0f8f07d7443695e14a18488cb499d3b4d.tar.bz2
gh-123213: Fixed xml.etree.ElementTree.Element.extend and assignment to no longer hide exceptions (GH-123214)
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 3818e20..ec99958 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -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);