ElementTree.iselement() returns true for the Element type
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
According to documentation, ElementTree.iselement() check if the argument is an element object.
But it returns true also for the Element type which has all attributes of an Element instance. The way how the Element class is defined in Python suggests that this may be intentional, but the intention was lost in the documentation.
There is also an example of dataclasses.is_dataclass() which returns true both for a dataclass type and for a dataclass instance.
So, there are two ways:
- Fix the documentation to match the current behavior. All uses of
iselement()(see #135640) should also check if the argument is a type is they need an element object. - Fix the implementation to check if the argument is a type. This may break the user code that uses it to check for the Element type (I don't know if it exists) but may fix bugs in the user code which expects that
iselement()works as documented.
cc @scoder
Linked PRs
- gh-136482
- gh-136484
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 pela documentação e pela implementação de ElementTree.iselement(), depois examine os PRs vinculados gh-136482 e gh-136484 e os usos referenciados em #135640. O trabalho estará concluído quando for resolvido se o comportamento documentado ou a implementação deve mudar, e quando o comportamento ou a documentação relevante forem atualizados de forma consistente.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- api
- Tipo de issue
- Bug
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 20/100