Skip to content

Behaviour change in defaultdict.__missing__ between 3.13.11 and 3.13.12 #148242

@cbourjau

Description

@cbourjau

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 #142668

Was this an intentional fix?

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions