`xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed"
未关闭
还没有人认领这个 Issue。
pending
tests
type-feature
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- 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