Skip to content

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

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
fedonman:fix-minidom-rename-attr-prefix
Nov 13, 2026
Merged

serhiy-storchaka merged 3 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.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but could you please added test for renaming an element node?

@fedonman

Copy link
Copy Markdown
Contributor Author

Thanks, done.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM. πŸ‘

@serhiy-storchaka
serhiy-storchaka merged commit f345a1e into python:main Nov 13, 2026
61 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.

2 participants