Issue #25691: Fixed crash on deleting ElementTree.Element attributes.

This commit is contained in:
Serhiy Storchaka 2015-11-23 08:49:39 +02:00
commit 0cd3effacd
4 changed files with 67 additions and 0 deletions

View file

@ -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)