New submission from Étienne BERSAC :
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
Traceback (most recent call last):
File "bug.py", line 10, in
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
(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
<http://bugs.python.org/issue10205>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com