Repository navigation
world_names: treat CDATA as text when extracting XML names - #6453
Open
l-CatDemon-l wants to merge 1 commit into
Open
l-CatDemon-l wants to merge 1 commit into
l-CatDemon-l wants to merge 1 commit into
Conversation
Tag-like text in CDATA and processing instructions appeared as names. Escape CDATA and skip comments and instructions before looking for tags. Keep recovery at the next XML declaration after an unfinished comment. Co-Authored-By: Codex <noreply@openai.com>
Contributor
|
Tested a7bdb9d on Windows 11, Python 3.12 (CPU only): pass
AI-assisted (Claude Code). |
1 of 2 tasks
Contributor
|
Tested a7bdb9d merged with main a6a7aba on Linux/Python 3.12.16: pass Commands run (merged worktree,
Diff read: one regex ( |
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.
Claimed in the coordination issue as: XML name extraction and CDATA in #6214.
What and why
world_names.pycould add tag-like text from CDATA, processing instructions, or a comment containing a literal XML declaration to the name dictionary. It now searches for tags after escaping CDATA and removing comments and processing instructions. CDATA within a real field remains literal text, and an unfinished comment can still end at the next document's declaration in concatenated input.The change merges cleanly with
mainatf6c6d11ee. In the overlap check on9077af1f3, #5618 merged cleanly and #4404 had the sameos.walkconflict with bothmainand the CDATA branch.Tested
Commit
a7bdb9d0aca71390b665e282bebd5902c6d3883f. WSL, Python 3.12.3, CPU only. All 62 applicable tests passed on the branch and on the trial merge withmain. One filesystem permissions test intest_gamedata_xml.pyskipped under root. The recovery test failed when the next-declaration check was removed in a temporary copy and passed after it was restored.Independent check (separate tree, WSL
python3 -I -B):main's parser with this branch's tests: 2 failures (the comment and the CDATA/PI cases); the branch: 31/31.xml.etreeon randomly generated well-formed documents with CDATA, comments, PIs and name tags: 0 differences in 50,392 documents on the branch (about 22,400 onmain); concatenated-input cases 7/7 (main3/7). Two older limits are untouched and outside this PR: a name tag nested inside another name tag, and<filename>with child elements.Windows 11 (build 26200), Python 3.13.1, CPU only. A single
python.exe -I -Binvocation passed three targeted regressions (exit 0) on18634097c, before the test-only amendment.AI-assisted: yes
Checklist
docs/design.md, with how it was confirmed. (N/A, no translator change)