[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Can you please provide an example of data for which the tostring method fails? I can't reproduce this on simple data. import xml.etree.ElementTree as ET ET.tostring(ET.XML('rootbq/bwerty/root'), method='text', encoding='unicode') 'qwerty' --

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I found such example. It happens when the data contains XML entity. ET.tostring(ET.XML('rootaamp;/root'), method='text', encoding='unicode') Traceback (most recent call last): File stdin, line 1, in module File

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Frank
Frank added the comment: It happens whenever the method is called, regardless of input. I'm using HTML that has been tidied first with HTML entities (if any) converted to unicode values. -- ___ Python tracker rep...@bugs.python.org

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Frank
Frank added the comment: Scratch that, it happens whenever there are XML entities (lt;, quot; and friends) that are appearing the text as you pointed out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16913

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch for 3.3+. 2.7 and 3.2 are not affected. -- keywords: +patch stage: needs patch - patch review versions: +Python 3.4 Added file: http://bugs.python.org/file28666/etree_itertext.patch ___ Python

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset d965ff47cf94 by Eli Bendersky in branch '3.3': Issue #16913: Fix Element.itertext()'s handling of text with XML entities. http://hg.python.org/cpython/rev/d965ff47cf94 New changeset 9ab8632e7213 by Eli Bendersky in branch 'default': Issue #16913:

[issue16913] ElementTree tostring error when method='text'

2013-01-10 Thread Eli Bendersky
Eli Bendersky added the comment: Fixed. Thanks. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16913 ___

[issue16913] ElementTree tostring error when method='text'

2013-01-09 Thread Frank
New submission from Frank: Since upgrading to python 3.3 the tostring method fails when the output method is requested as text. Code like this: with open(fp, mode='rt') as f: data = f.read() tree, idmap = ET.XMLID(data) print(ET.tostring(tree, method='text', encoding='unicode')) Generates

[issue16913] ElementTree tostring error when method='text'

2013-01-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +3.3regression nosy: +eli.bendersky, ezio.melotti stage: - needs patch type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16913