Fix bugs where exceptions could end up being overwritten.
--- /dev/null
+Fix bugs in :mod:`!_elementtree` where exceptions could be overwritten.
}
while (attrib_in[0] && attrib_in[1]) {
PyObject* key = makeuniversal(self, attrib_in[0]);
+ if (key == NULL) {
+ Py_DECREF(attrib);
+ Py_DECREF(tag);
+ return;
+ }
PyObject* value = PyUnicode_DecodeUTF8(attrib_in[1], strlen(attrib_in[1]), "strict");
- if (!key || !value) {
- Py_XDECREF(value);
- Py_XDECREF(key);
+ if (value == NULL) {
+ Py_DECREF(key);
Py_DECREF(attrib);
Py_DECREF(tag);
return;