diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-23 06:42:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-23 06:42:25 (GMT) |
commit | b6aa5375d5a2f81370338357506034befe62aa31 (patch) | |
tree | 39832d710263d64a001307f8f23a7d9515eeacbf /Modules/_elementtree.c | |
parent | 8bc792a602311e426cbd69293627fdc9287a5c7b (diff) | |
download | cpython-b6aa5375d5a2f81370338357506034befe62aa31.zip cpython-b6aa5375d5a2f81370338357506034befe62aa31.tar.gz cpython-b6aa5375d5a2f81370338357506034befe62aa31.tar.bz2 |
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
Diffstat (limited to 'Modules/_elementtree.c')
-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 da784a0..3b6ee89 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1852,6 +1852,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) |