[New-bugs-announce] [issue10205] Can't have two tags with the same QName
Étienne BERSAC
report at bugs.python.org
Tue Oct 26 21:40:49 CEST 2010
New submission from Étienne BERSAC <bersace03 at gmail.com>:
Hi,
Here is the code to reproduce and the unexcpected behaviour :
21:37:41 bersace at st-francois-de-sales:~/Bureau/$ cat bug.py
from xml.etree.ElementTree import QName, ElementTree, Element, SubElement
import sys
head = Element(QName('http://www.w3.org/1999/xhtml', 'html'))
SubElement(head, QName('http://www.w3.org/1999/xhtml', 'meta'))
SubElement(head, QName('http://www.w3.org/1999/xhtml', 'meta'))
tree = ElementTree(head)
tree.write(sys.stdout, encoding="utf-8", xml_declaration=True,
default_namespace='http://www.w3.org/1999/xhtml')
21:38:00 bersace at st-francois-de-sales:~/Bureau/$ python2.7 bug.py
<?xml version='1.0' encoding='utf-8'?>
Traceback (most recent call last):
File "bug.py", line 10, in <module>
default_namespace='http://www.w3.org/1999/xhtml')
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 812, in write
self._root, encoding, default_namespace
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 880, in _namespaces
_raise_serialization_error(tag)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1046, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize <xml.etree.ElementTree.QName object at 0xb76aa60c> (type QName)
21:38:01 bersace at st-francois-de-sales:~/Bureau/$
Patch is attached.
Regards,
Étienne
----------
components: XML
files: python2.7-fix-qname-already-registered.patch
keywords: patch
messages: 119643
nosy: bersace
priority: normal
severity: normal
status: open
title: Can't have two tags with the same QName
versions: Python 2.7
Added file: http://bugs.python.org/file19374/python2.7-fix-qname-already-registered.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10205>
_______________________________________
More information about the New-bugs-announce
mailing list