Crash in PyDict_AsFrozenDictAndClear() with obj.__dict__
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
Direção de pesquisa
Read the crash reproducer in the issue and inspect the relevant dict handling in Objects/dictobject.c, where the debug assertion fails. Start by tracing how PyDict_AsFrozenDictAndClear() handles instance dictionaries with inline values; done means the assertion passes and the frozen dictionary remains valid after mutating or deleting the original instance. The issue lists linked PR gh-161768, so check its status before starting.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Crash report
The frozendict C API crashes when given an instance __dict__ that still has inline values:
import _testcapi
class A: pass
a = A(); a.x = 1; a.y = 2
f = _testcapi.dict_as_frozendict_and_clear(a.__dict__)
a.x = 'MUTATED'
print(f)
Debug build fails an assertion in Objects/dictobject.c. The keys are moved to the frozendict but the values stay in the object's inline values, so both end up sharing them (use-after-free after del a).
CPython versions tested on:
CPython main branch
Operating systems tested on:
Windows
Output from running 'python -VV' on the command line:
Python 3.16.0a1+dev (heads/main:9d05428, Nov 10 2026, 19:53:18) [MSC v.1951 64 bit (AMD64)]
Linked PRs
- gh-161768
- Linguagem predominante
- Python
- Estrelas
- 78.2k
- Forks
- 36.6k
- Merge médio
- 19h 57min
- PRs com merge (30d)
- 630
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o 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.
Mais de python/cpython
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
stdlib type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
-
extension-modules stdlib topic-XML type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
python/cpython#161807 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
stdlib type-feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
python/cpython#161788 · 7 comentários ·
Mantenedores costumam responder em até 1 dia
-
extension-modules topic-IO type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Mantenedores costumam responder em até 1 dia
Todas as issues de python/cpython
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
cpp-best-practices/project_validator#267 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Project-N-E-K-O/N.E.K.O#3725 ·
Mantenedores costumam responder em até 1 dia
-
[Bug] Sending a Telegram message chain twice duplicates mentionsTalvez já em andamento @123XieC assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
AstrBotDevs/AstrBot#11125 ·
Mantenedores costumam responder em até 1 dia
-
backend bug priority: high
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
nooriegarg/ContribIQ#73 ·
Mantenedores costumam responder em até 1 dia
-
bug p3 security
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
amd/gaia#8197 · 2 comentários ·
Mantenedores costumam responder em até 1 dia