`xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed"
Đang mở
Chưa có ai nhận issue này.
pending
tests
type-feature
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu tại Lib/xml/dom/domreg.py, ở các dòng 73-76, và xem xét vòng lặp fallback được mô tả trong issue. Xác minh rằng chỉ các exception thiếu triển khai đã nêu mới bị bỏ qua, trong khi các lỗi khác vẫn hiển thị; chạy các bài kiểm thử XML DOM liên quan hoặc reproducer được cung cấp để xác nhận hành vi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 25/100