-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-13611: C14N 2.0 implementation for ElementTree #12966
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
Conversation
…r in "_elementtree" to make it use the same factories as the ElementTree module, and to make it explicit when the comments/PIs are inserted into the tree and when they are not (which is the default).
…MLParser target in ElementTree.
…ck receives the calls in the right order.
Missing features: - prefix renaming in XPath expressions (tag and attribute text is supported) - preservation of original prefixes given redundant namespace declarations
a3ed3f9
to
c00dd43
Compare
…, especially since we don't really know the correct encoding (some files use Latin-1, others UTF-8).
… and/or no attributes.
…se (and use what lxml uses for C14N 1.0).
…its result as text string if not output file is provided.
…y file-like objects.
I tested this PR locally, and there seems to be reference leaks. The following is the output of
|
@ZackerySpytz, thanks for testing (and providing the command :) ) |
Modules/_elementtree.c
Outdated
@@ -3783,6 +3787,8 @@ xmlparser_gc_traverse(XMLParserObject *self, visitproc visit, void *arg) | |||
Py_VISIT(self->handle_data); | |||
Py_VISIT(self->handle_start); | |||
Py_VISIT(self->handle_start_ns); | |||
Py_VISIT(self->handle_end_ns); | |||
Py_VISIT(self->handle_doctype); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually missing before. Since it refers to an arbitrary user provided (callable) object, it must be visible to the GC.
This is based on GH-12883 and GH-12885.
The only changes that are relevant to this PR are in
ElementTree.py
and the C14N test case intest_xml_etree.py
, plus the added C14N 2.0 test files.Documentation missing, pending a review of the overall API.
https://bugs.python.org/issue13611