typing._allow_reckless_class_checks doesn't work when _abc doesn't exist.
Ninguém assumiu esta issue ainda.
- 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:
When typing._caller's sys._getframe fallback is triggered without _abc module, _typing._allow_reckless_class_checks fails to check _py_abc while running abc.ABCMeta.__instancecheck__.
Without _abc module, _typing._allow_reckless_class_checksfails to check _py_abc
Related code in typing.py:
https://github.com/python/cpython/blob/v3.14.0b3/Lib/typing.py#L1846-L1863
This is technically a bug of typing.py, but really hard to be triggered on CPython.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Solution suggestion
Patch typing._allow_reckless_class_checks to also check _py_abc
This is the most conservative approach. Compatible with all of previous scenarios and additionally fixing the bug.
Patch typing._caller to remove sys._getframe or raise warning when fallback
If the the typing requires to work with sys._getframemodulename, then let the users to know it has a caveat.
Linked PRs
- gh-136115
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
Leia as linhas 1846-1863 de Lib/typing.py e compare a alteração proposta com o PR vinculado gh-136115. Está concluído quando _allow_reckless_class_checks também tratar _py_abc quando _abc não estiver disponível, com o comportamento verificado no branch principal do CPython.
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
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 25/100