Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElementTree: allow passing XMLPullParser instance into iterparse() #64418

Open
scoder opened this issue Jan 10, 2014 · 1 comment
Open

ElementTree: allow passing XMLPullParser instance into iterparse() #64418

scoder opened this issue Jan 10, 2014 · 1 comment
Labels
stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement

Comments

@scoder
Copy link
Contributor

scoder commented Jan 10, 2014

BPO 20219
Nosy @scoder

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2014-01-10.19:55:57.772>
labels = ['expert-XML', 'type-feature', 'library']
title = 'ElementTree: allow passing XMLPullParser instance into iterparse()'
updated_at = <Date 2014-01-10.19:55:57.772>
user = 'https://github.com/scoder'

bugs.python.org fields:

activity = <Date 2014-01-10.19:55:57.772>
actor = 'scoder'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)', 'XML']
creation = <Date 2014-01-10.19:55:57.772>
creator = 'scoder'
dependencies = []
files = []
hgrepos = []
issue_num = 20219
keywords = []
message_count = 1.0
messages = ['207877']
nosy_count = 2.0
nosy_names = ['scoder', 'eli.bendersky']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue20219'
versions = ['Python 3.5']

@scoder
Copy link
Contributor Author

scoder commented Jan 10, 2014

in the XMLPullParser ticket

http://bugs.python.org/issue17741

specifically here:

http://bugs.python.org/msg196177

it says:

"""

  • [The pull parser] will *not* accept a "parser" argument in the constructor.
    Rationale: the parser argument of iterparse is broken anyway. This will
    make it much easier to modify the implementation of EventParser in the
    future when the C internals are fixed w.r.t problems mentioned in this issue.

  • iterparse's "parser" argument will be deprecated, and the documentation
    will be more detailed w.r.t to the limitations on its current "parser"
    argument (the limitations are there in the code, but they're not fully
    documented).
    """

And the "parser" argument to iterparse is now deprecated, according to the
docs:

http://docs.python.org/3.4/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse

In lxml, however, I'm noticing that it would be really helpful to pass a
pull parser into iterparse(). Essentially, iterparse() is now stripped down
to a wrapper around the pull parser(s: XML/HTML in lxml) that simply serves
the feeding side of the interface for the user's convenience.

Note that lxml's iterparse() never had a "parser" argument. That's for
historical reasons, because it originally *was* a parser itself, but it
no longer is now.

I'd like to allow passing pull parsers into iterparse(), so that users can
configure them on their own. Currently, iterparse() must duplicate
basically all of the parser configuration arguments. I'd like to deprecate
that in lxml and replace it with the same simple interface as in ET, i.e.
pass in *either* a set of events *or* a readily configured pull parser.
Preferably raising an error if users pass both.

Could we change the deprecation from "argument is deprecated" to "passing a
normal (non-pull) parser into iterparse is deprecated", and then allow
passing a pull parser in the future?

@scoder scoder added stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement labels Jan 10, 2014
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir topic-XML type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant