summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 62374d8..12e418d 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -352,7 +352,10 @@ get_attrib_from_keywords(PyObject *kwds)
return NULL;
}
attrib = PyDict_Copy(attrib);
- PyDict_DelItem(kwds, attrib_str);
+ if (attrib && PyDict_DelItem(kwds, attrib_str) < 0) {
+ Py_DECREF(attrib);
+ attrib = NULL;
+ }
} else {
attrib = PyDict_New();
}