[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2019-05-10 Thread Stefan Behnel
Stefan Behnel added the comment: I think this is resolved by issue 36673 (Py3.8). Please try it in the just released alpha4. -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Than your for your example Martin. Now I see what is not working. Indeed, using the TreeBuilder subclass is recommended way, but iterparse() was designed to accept only exact TreeBuilder. Actually there is an intention to consider the parser parameter of

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-11 Thread Stefan Behnel
Stefan Behnel added the comment: lxml supports "comment" and "pi" as event types in iterparse (or, more specifically, in the XMLPullParser). If someone wants to implement this for (c)ElementTree, I'd be happy to review the PR. https://lxml.de/api/lxml.etree.XMLPullParser-class.html

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-10 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-09 Thread Martin Hosken
Martin Hosken added the comment: Blast. Bugs. Sorry. Missing superclass init call in CommentingTb. I enclose the whole thing again to save editing. Also fixes comment output to give text. from __future__ import print_function import sys import xml.etree.ElementTree as et import

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-09 Thread Martin Hosken
Martin Hosken added the comment: Sorry. This test is rather long because it is 3 tests: from __future__ import print_function import sys import xml.etree.ElementTree as et import xml.etree.cElementTree as cet from io import StringIO teststr = u""" Hello World """ testf =

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-08 Thread Stefan Behnel
Stefan Behnel added the comment: There are dedicated handler methods that you can implement: "def comment(self, comment)" and "def pi(self, target, data)". Both (c)ElementTree and lxml support those. I think the "target" argument to the parser is a bit underdocumented, and the standard

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > But the C version XMLParser requires that its TreeBuilder not be a subclass, > when used in iterparse. Creating a TreeBuilder subclass looks the Right Way. What are problems with this? Could you please provide a complete script that works in 2.7, but

[issue34600] python3 regression ElementTree.iterparse() unable to capture comments

2018-09-07 Thread Martin Hosken
New submission from Martin Hosken : This is a regression from python2 by being forced to use cElementTree. I have code that uses iterparse to process an XML file, but I also want to process comments and so I have a comment handling function called by the parser during iterparse. Under