`xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed"
未關閉
還沒有人認領這個 Issue。
pending
tests
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
- Location:
Lib/xml/dom/domreg.py:73-76
- Problem: When called with no explicit implementation name, tries each well-known implementation (
minidom,4DOM) in turn underexcept Exception: continue(comment: "typically ImportError, or AttributeError"). A genuine bug in a candidate'sgetDOMImplementation()factory (e.g. a realAttributeErrorfrom a typo) is caught identically to "this implementation isn't available" and silently skipped. - Reproducer (verified): registered a fake well-known implementation whose
getDOMImplementation()deliberately raisesAttributeErrorto simulate a real bug (not a missing-moduleImportError); the fallback loop silently moved on tominidomwith no trace of the failure. - Suggested fix: Catch
(ImportError, AttributeError)specifically, matching what the comment already says is "typical." - Difficulty: Trivial. Note: low real-world impact since
well_known_implementationsis a tiny, fixed, mostly-dead-code dict — good for a first-time contributor precisely because it's low-stakes.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-155948
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 Lib/xml/dom/domreg.py 的第 73-76 行開始,檢查 issue 中描述的回退迴圈。驗證僅跳過所述的缺少實作例外,而其他失敗仍保持可見;執行相關的 XML DOM 測試或提供的 reproducer,以確認此行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100