python / python/cpython

Behaviour change in defaultdict.__missing__ between 3.13.11 and 3.13.12

Aberta
#148,242 6 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

stdlib type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Bug report

Bug description:

I have observed a subtle change in behavior of defaultdict.__missing__ between Python 3.13.11 and 3.13.12. Consider the following output:

3.13.11:

$ uv run --python 3.13.11 python -c 'from collections import defaultdict; print(defaultdict(lambda: "A", {None: "B"}).__missing__(None))'
Using CPython 3.13.11
Creating virtual environment at: .venv
      Built pdonnx @ file:///Users/christian.bourjau/repos/pdonnx
Installed 1 package in 1ms
A

3.13.12:

$ uv run --python 3.13.12 python -c 'from collections import defaultdict; print(defaultdict(lambda: "A", {None: "B"}).__missing__(None))'
Using CPython 3.13.12
Removed virtual environment at: .venv
Creating virtual environment at: .venv
Installed 1 package in 1ms
B

The same change in behavior can be observed between 3.14.2 and 3.14.3.

This might be related to #142495 and https://github.com/python/cpython/pull/142668

Was this an intentional fix?

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs
  • gh-148880
  • gh-148881

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 reproduzindo o comportamento relatado de defaultdict.missing(None) no Python 3.13.11, 3.13.12, 3.14.2 e 3.14.3 e, em seguida, leia o contexto nos issues #142495 e pull request #142668. Revise os PRs vinculados gh-148880 e gh-148881; o trabalho estará concluído quando o comportamento pretendido estiver estabelecido e o issue tiver uma conclusão clara ou um follow-up.

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
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
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.