mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
This commit is contained in:
commit
0cd3effacd
4 changed files with 67 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue