New submission from Étienne BERSAC <bersac...@gmail.com>: Hi,
Here is the code to reproduce and the unexcpected behaviour : 21:37:41 bers...@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 bers...@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 bers...@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 <rep...@bugs.python.org> <http://bugs.python.org/issue10205> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com