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
xml.etree.ElementTree.extend does not work with iterators when using the Python implementation #87565
Comments
This issue is only visible when the C accelerator of ElementTree is *not* used. It is the counterpart of the following issue on PyPy3: https://foss.heptapod.net/pypy/pypy/-/issues/3181 >>> from xml.etree.ElementTree import Element
>>> r = Element("root")
>>> r.extend((Element(str(i)) for i in range(3)))
>>> print(list(r))
[] When using the C accelerator, the list is not empty, as expected. In the Python code, a check on the input empties the input iterator. The fix is trivial (one-line change), so if you are interested I could open a PR, which would be my first, so a good occasion to go through the devguide ;) |
Your proposed fix LGTM. Please open a PR. Don't forget about test and NEWS entry. |
Thanks for the report and the PR. I would argue that this can still be fixed in Py3.8, given the low impact (but not earlier). The behaviour is clearly wrong (in a subtle way) and most users won't notice it because they won't switch off the C accelerator module. |
+1 for back porting, but check with the RM first. |
Is there anything else I should be doing, in order to get this merged in time for 3.10? (the PR is "awaiting merge") Regarding the backporting, I understand from the devguide this is done automatically from GitHub labels (nice!), but it does not look like I have the rights to add those to my PR. |
Pinging us was the only action needed. Thank you for your contribution Alex. |
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: