diff options
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) |