-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-37399: Correctly attach tail text to the last element/comment/pi #14856
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
… even when comments or pis are discarded. Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
I think it would be nice to add a test case for Whitespace Processing, something like: <a>text
<!-- comment -->
tail</a> I can't tell off the top of my head what the text value should be :) Ref: e.g. https://docstore.mik.ua/orelly/xml/schema/ch04_02.htm |
My compiler complains of logical ops not being explicit enough. Personally I think it's silly, but the rest of CPython code base uses explicit parentheses in such cases,
|
…xt/tail content works as expected.
Thanks @dimaqq, I followed both of your suggestions. |
Hi Stefan, I'm afraid there's a memory leak, consider this program: from xml.etree import ElementTree
while True: ElementTree.fromstring("<a>text<!--c1-->a<!--c2-->b<!--c3-->foo</a>").text d395209, common ancestor with master branch: ~5MB, stable |
I tested this PR locally, and I see the following when
|
…mpiler validate the usage on all code paths.
…ntent around comments/pis.
Thanks for testing and reporting the leak. I resolved it, and also cleaned up a couple of other places to make them clearer. |
Thanks @scoder for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8. |
Sorry, @scoder, I could not cleanly backport this to |
…nt/pi (pythonGH-14856) * bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded. Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
GH-14936 is a backport of this pull request to the 3.8 branch. |
…ythonGH-14856) * bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded. Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
…ythonGH-14856) * bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded. Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
…ythonGH-14856) * bpo-37399: Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded. Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
Correctly attach tail text to the last element/comment/pi, even when comments or pis are discarded.
Also fixes the insertion of PIs when "insert_pis=True" is configured for a TreeBuilder.
https://bugs.python.org/issue37399