Skip to content

gh-159637: Fix renaming an attribute to a prefixed name in minidom - #159638

Open
fedonman wants to merge 2 commits into
python:mainfrom
fedonman:fix-minidom-rename-attr-prefix
Open

fedonman wants to merge 2 commits into
python:mainfrom
fedonman:fix-minidom-rename-attr-prefix

Conversation

@fedonman

@fedonman fedonman commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Document.renameNode() now sets the new namespace of an attribute before its prefix, so the prefix is checked against the namespace it is being renamed into. The prefix is also checked before the attribute is removed from its element, so a rejected rename leaves the element unchanged.

Document.renameNode() set the new prefix of an attribute before its
new namespace, so the prefix was validated against the old namespace.
Renaming an attribute with no namespace to a prefixed name in a
namespace raised NamespaceErr after the attribute had been removed
from its element.

Set the namespace first, and check the prefix before removing the
attribute, so that a rejected rename leaves the element unchanged.
@fedonman

fedonman commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@serhiy-storchaka, could you take a look when you have a moment? It fixes a regression from GH-156666.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant