diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-23 06:47:26 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-23 06:47:26 (GMT) |
commit | 3987fefd6f7309a36fb093cbfe229afe7b39406b (patch) | |
tree | e57eab9c07cc1c34906dee5e0f34cbe58c21a93f /Modules | |
parent | 21cecb904f80a53a23dc972c95cb0c4c997afbe1 (diff) | |
parent | b6aa5375d5a2f81370338357506034befe62aa31 (diff) | |
download | cpython-3987fefd6f7309a36fb093cbfe229afe7b39406b.zip cpython-3987fefd6f7309a36fb093cbfe229afe7b39406b.tar.gz cpython-3987fefd6f7309a36fb093cbfe229afe7b39406b.tar.bz2 |
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_elementtree.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 02cd6d4..744e833 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1921,6 +1921,12 @@ static int element_setattro(ElementObject* self, PyObject* nameobj, PyObject* value) { char *name = ""; + + if (value == NULL) { + PyErr_SetString(PyExc_AttributeError, + "can't delete attribute"); + return -1; + } if (PyUnicode_Check(nameobj)) name = _PyUnicode_AsString(nameobj); if (name == NULL) |