Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reusing an attribute dictionary across calls to
TreeBuilder.start()can change attributes on previously created elements in the C accelerator. Copy the dictionary at the publicstart()boundary when using the default element factory, matching the Python implementation.Custom factories still receive the original dictionary. The XML parser's internal path already owns its attributes and is unchanged. This addresses the
TreeBuilder.start()part of #80866; the separatecopy.copy(Element)behavior is outside this PR's scope.The tests cover input dictionary isolation (including empty dictionaries and subclasses), reuse across sibling elements, and preserving custom-factory argument identity. The regressions fail on the unpatched C accelerator and pass on both implementations with the fix.
Validation on a macOS arm64 debug build:
./python.exe -m test -j8 --timeout=300— SUCCESS; 52,312 tests run, 3,053 skipped (default resources)../python.exe -m test test_xml_etree test_xml_etree_c./python.exe -m test test_xml_etree test_xml_etree_c -R 3:3make patchcheckgit diff --checkThanks to Gordon P. Hemsley for the original report, and Stefan Behnel and Serhiy Storchaka for suggesting copying at the input boundary in #80866 and #76605.
AI assistance was used for investigation, implementation, and test execution!