`xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed"
Aberta
Ninguém assumiu esta issue ainda.
pending
tests
type-feature
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece em Lib/xml/dom/domreg.py, nas linhas 73-76, e revise o loop de fallback descrito na issue. Verifique se apenas as exceções de implementação ausente indicadas são ignoradas, enquanto as outras falhas permanecem visíveis; execute os testes relevantes de XML DOM ou o reproducer fornecido para confirmar o comportamento.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- backend
- Tipo de issue
- Bug
- Dificuldade
- 1/5
- Tempo estimado
- Menos de uma hora
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 25/100