Skip to content

[3.14] gh-156812: Check structural rules when serializing in xml.dom.minidom (GH-161830) - #162681

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-79494e2-3.14
Nov 26, 2026
Merged

serhiy-storchaka merged 1 commit into
python:3.14from
serhiy-storchaka:backport-79494e2-3.14

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

(cherry picked from commit 79494e2)

Manual backport: the cherry-pick conflicted because _quote_literal() is inserted above _check_name(), which only exists on main.

xml.is_valid_name() and xml.is_valid_text() do not exist in 3.14, so three things are omitted: the _check_name() call for the processing instruction target, the test for it, and the sentence recommending xml.is_valid_text() in the documentation.

3.14 therefore still does not check the target name at all, which is consistent with createProcessingInstruction() not checking it either. The other checks and the NEWS entry are unchanged.

🤖 Generated with Claude Code

…l.dom.minidom (pythonGH-161830)

Only the structure is checked, not the characters.

A comment ending with '-' was fused with the closing '-->' into '--->'.
A processing instruction was not checked at all: '?>' in the data silently
closed it, and the reserved target 'xml' produced a document which cannot
be parsed.  The identifiers of the document type declaration were
interpolated into single quotes without checks, so an identifier containing
a quote or other illegal character produced XML which is not well-formed,
and a public identifier without a system identifier produced the literal
'None'.
(cherry picked from commit 79494e2)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) November 26, 2026 11:44
@serhiy-storchaka
serhiy-storchaka merged commit 7419cc1 into python:3.14 Nov 26, 2026
89 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant