[New-bugs-announce] [issue31428] ElementTree.Element.__deepcopy__() raises a SystemError in case of a bad memo

Oren Milman report at bugs.python.org
Tue Sep 12 08:04:08 EDT 2017


New submission from Oren Milman:

The following code causes ElementTree.Element.__deepcopy__() to raise a
SystemError:

class BadMemo:
    def get(*args):
        return None

import xml.etree.ElementTree
xml.etree.ElementTree.Element('foo').__deepcopy__(BadMemo())


this is because _elementtree_Element___deepcopy__() (in Modules/_elementtree.c)
assumes that memo is a dictionary, and passes it to PyDict_SetItem(), which
raises the SystemError.

----------
components: XML
messages: 301953
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: ElementTree.Element.__deepcopy__() raises a SystemError in case of a bad memo
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31428>
_______________________________________


More information about the New-bugs-announce mailing list