Skip to content

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

Merged
merged 26 commits into from
May 1, 2019

Conversation

scoder
Copy link
Contributor

@scoder scoder commented Apr 26, 2019

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 in test_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

scoder added 5 commits April 20, 2019 11:18
…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).
Missing features:
- prefix renaming in XPath expressions (tag and attribute text is supported)
- preservation of original prefixes given redundant namespace declarations
@scoder scoder force-pushed the bpo-13611_et_c14n2 branch from a3ed3f9 to c00dd43 Compare April 26, 2019 09:12
@ZackerySpytz
Copy link
Contributor

I tested this PR locally, and there seems to be reference leaks. The following is the output of ./python -m test -R 3:3 test_xml_etree_c:

Run tests sequentially
0:00:00 load avg: 1.09 [1/1] test_xml_etree_c
beginning 6 repetitions
123456
......
test_xml_etree_c leaked [208, 208, 208] references, sum=624
test_xml_etree_c leaked [51, 51, 51] memory blocks, sum=153
test_xml_etree_c failed

== Tests result: FAILURE ==

1 test failed:
    test_xml_etree_c

Total duration: 2 sec 801 ms
Tests result: FAILURE

@scoder
Copy link
Contributor Author

scoder commented May 1, 2019

@ZackerySpytz, thanks for testing (and providing the command :) )
I'll look into it.

@@ -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);
Copy link
Contributor Author

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.

@scoder scoder merged commit e1d5dd6 into python:master May 1, 2019
@scoder scoder deleted the bpo-13611_et_c14n2 branch May 10, 2019 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants