This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Oren Milman
Recipients Oren Milman
Date 2017-10-08.20:16:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1507493787.35.0.213398074469.issue31728@psf.upfronthosting.co.za>
In-reply-to
Content
The following code causes the interpreter to crash:
import xml.etree.ElementTree
class X:
    def __del__(self):
        elem.clear()
elem = xml.etree.ElementTree.Element('elem')
elem.text = X()
elem.clear()

This is because _elementtree_Element_clear_impl() decrefs self->text in an
unsafe manner.
For the same reason, but for self->tail, a crash would happen if we replaced
'elem.text = X()' with 'elem.tail = X()'.


Similarly, the following code also causes the interpreter to crash:
import xml.etree.ElementTree
class X:
    def __del__(self):
        elem.clear()
elem = xml.etree.ElementTree.Element('elem')
elem.text = X()
elem.text = X()

This is because element_text_setter() decrefs self->text in an unsafe manner.
element_tail_setter() does the same for self->tail, so again, if we replaced
'elem.text = X()' with 'elem.tail = X()', we would also get a crash.
History
Date User Action Args
2017-10-08 20:16:27Oren Milmansetrecipients: + Oren Milman
2017-10-08 20:16:27Oren Milmansetmessageid: <1507493787.35.0.213398074469.issue31728@psf.upfronthosting.co.za>
2017-10-08 20:16:27Oren Milmanlinkissue31728 messages
2017-10-08 20:16:27Oren Milmancreate