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.findtext() returns empty bytes object instead of empty string #61126
Comments
>>> import xml.etree.cElementTree as ET
>>> ET.XML('<root><empty /></root>').findtext('empty')
b'' |
I see yet one possible bug, using PyBytes_FromString() in list_join() on 3.2. But I can't demonstrate an example. |
The fix looks good, but please don't add tests to the doctests - they are deprecated (from 3.3) |
But all findtext tests are doctests and I want to keep the tests together. I think there should be separated issue for converting ElementTree doctests to unittests. |
Serhiy, indeed - that's issue bpo-15083. But since rewriting all tests is a large task no one is willing to take at this point, my strategy has been incremental: rewrite a chunk at a time when tests are being touched. Just adding new doctests goes against the desired direction. I'll convert the findtext tests to unittest in 3.3 and default and then you can add your new tests in the proper place. Stay tuned. |
Tests ported in 3.3 and 3.4 |
Here is a patch for 3.3+. |
PyUnicode_New has been added in 3.3, so the 3.2 patch doesn't compile. |
Indeed. Patch updated. |
New changeset 849eb27baf1c by Eli Bendersky in branch '3.2': New changeset 6323e5f1ed81 by Eli Bendersky in branch '3.3': New changeset c38423931724 by Eli Bendersky in branch 'default': |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: