classification
Title: Crash on deleting Element attribute
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.3, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eli.bendersky, larry, martin.panter, python-dev, scoder, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2015-11-21 17:04 by serhiy.storchaka, last changed 2015-11-23 07:28 by larry. This issue is now closed.

Files
File name Uploaded Description Edit
etree_del_attributes.patch serhiy.storchaka, 2015-11-21 17:04 review
Messages (5)
msg255063 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-21 17:04
>>> import xml.etree.ElementTree as ET
>>> e = ET.Element('tag')
>>> del e.tag
Segmentation fault (core dumped)

Proposed patch fixes the crash.
msg255125 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-11-23 04:58
The patch looks good to me.

This may be a side effect of poor documentation. I guess the documentation at <https://docs.python.org/dev/c-api/typeobj.html#c.PyTypeObject.tp_setattro> and/or the referenced functions should mention that the they also delete attributes when the name argument is null.
msg255129 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-11-23 06:50
New changeset 852c9ed9115c by Serhiy Storchaka in branch '3.4':
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
https://hg.python.org/cpython/rev/852c9ed9115c

New changeset 3a44f06907f1 by Serhiy Storchaka in branch '3.5':
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
https://hg.python.org/cpython/rev/3a44f06907f1

New changeset 936fcd0ba6b1 by Serhiy Storchaka in branch 'default':
Issue #25691: Fixed crash on deleting ElementTree.Element attributes.
https://hg.python.org/cpython/rev/936fcd0ba6b1

New changeset e3dea2e4f93d by Serhiy Storchaka in branch '2.7':
Issue #25691: Added tests on deleting cElementTree.Element attributes.
https://hg.python.org/cpython/rev/e3dea2e4f93d
msg255132 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-11-23 07:01
Thank you for your review Martin. Opened issue25701 for documenting.

Interestingly, 2.7 is free from this bug. It has a check for NULL.
msg255134 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-11-23 07:28
This change didn't make it into 3.5.1.  It will be released with 3.5.2.  I've already updated the Misc/NEWS entry.
History
Date User Action Args
2015-11-23 07:28:15larrysetnosy: + larry
messages: + msg255134
2015-11-23 07:01:10serhiy.storchakasetstatus: open -> closed
versions: - Python 2.7
messages: + msg255132

resolution: fixed
stage: patch review -> resolved
2015-11-23 06:50:56python-devsetnosy: + python-dev
messages: + msg255129
2015-11-23 04:58:38martin.pantersetnosy: + martin.panter
messages: + msg255125
2015-11-21 17:04:39serhiy.storchakacreate