Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`minidom` `renameNode()` drops an attribute renamed to a prefixed name

オープン 初心者向け
#159,637 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

issue では xml.dom.minidom.Document.renameNode() が特定され、再現コードが示されています。まず、その実装と renameNode() の近くにあるテストを読んでください。名前空間エラーを再現し、名前変更後も属性が要素に残ることを確認してください。期待される名前 p:a と名前空間を検証する回帰テストを追加または更新してください。

索引モデルが issue の本文から書いたものです。

説明

stdlib topic-XML type-bug
Bug description:

Since gh-156665, Document.renameNode() raises NamespaceErr when it renames an attribute with no namespace to a prefixed name in a namespace, and the attribute has already been removed from its element when the error is raised.

from xml.dom.minidom import parseString
doc = parseString('<r a="1" b="2"/>')
attr = doc.documentElement.getAttributeNode('a')
try:
    doc.renameNode(attr, 'http://example.com/ns', 'p:a')
except Exception as e:
    print(type(e).__name__, e)
print(doc.documentElement.toxml())
NamespaceErr cannot use the prefix 'p' with an empty namespace
<r b="2"/>

Expected: the attribute is renamed to p:a in http://example.com/ns and stays on the element, as on 3.15.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-159638
主要言語
Python
スター
77.6k
フォーク
38.4k
平均マージ
1日 5時間
マージ済み PR(30日)
555

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python/cpython のほかの issue

python/cpython の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。