BPO | [15290](https://bugs.python.org/issue15290) --- | :--- Nosy | @loewis, @pitrou Superseder | bpo-4851: xml.dom.minidom.Element.cloneNode fails with AttributeError Files | [minidom_setattribute.patch](https://bugs.python.org/file26317/minidom_setattribute.patch "Uploaded as text/plain at 2012-07-08.12:09:01 by @pitrou") *Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.* Show more details GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-bug', 'library'] title = 'setAttribute() can fail' updated_at = user = 'https://github.com/pitrou' ``` bugs.python.org fields: ```python activity = actor = 'berker.peksag' assignee = 'none' closed = True closed_date = closer = 'loewis' components = ['Library (Lib)'] creation = creator = 'pitrou' dependencies = [] files = ['26317'] hgrepos = [] issue_num = 15290 keywords = ['patch'] message_count = 7.0 messages = ['164954', '165007', '165008', '165009', '165010', '165011', '289063'] nosy_count = 3.0 nosy_names = ['loewis', 'pitrou', 'Craig Rodrigues'] pr_nums = [] priority = 'high' resolution = 'duplicate' stage = 'resolved' status = 'closed' superseder = '4851' type = 'behavior' url = 'https://bugs.python.org/issue15290' versions = ['Python 3.3'] ```
Activity
pitrou commentedon Jul 7, 2012
This is a regression from 3.2:
pitrou commentedon Jul 8, 2012
Trivial reproducer:
pitrou commentedon Jul 8, 2012
Here is a patch.
loewis commentedon Jul 8, 2012
That's invalid usage. You are supposed to create new element nodes through the document's createElement method. "unattached" nodes are not supported.
pitrou commentedon Jul 8, 2012
Well, I don't know how many third-party application rely on this, but
Twisted does it.
loewis commentedon Jul 8, 2012
Then Twisted will have to change. From
http://docs.python.org/library/xml.dom.minidom.html
"Applications should not instantiate the classes themselves; they should use the creator functions available on the Document object."
If they insist on not using createElement, they use internal API, and need to adjust that to new Python versions.
Closing as invalid.
CraigRodrigues commentedon Mar 6, 2017
Same issue was brought up in http://bugs.python.org/issue4851