python / python/cpython

`xml.dom.domreg.getDOMImplementation`: fallback discovery masks genuine bugs, not just "not installed"

Aberta
#155,944 2 comentários 0 reações 0 responsáveis Ver no GitHub

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

https://github.com/python/cpython/blob/cbe3a7f06a38c7fdda2d53183294499e533a3a0c/Lib/xml/dom/domreg.py#L72-L78

  • Problem: When called with no explicit implementation name, tries each well-known implementation (minidom, 4DOM) in turn under except Exception: continue (comment: "typically ImportError, or AttributeError"). A genuine bug in a candidate's getDOMImplementation() factory (e.g. a real AttributeError from 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 raises AttributeError to simulate a real bug (not a missing-module ImportError); the fallback loop silently moved on to minidom with 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_implementations is 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

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. 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

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.