Behaviour change in defaultdict.__missing__ between 3.13.11 and 3.13.12
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported defaultdict.missing(None) behavior on Python 3.13.11, 3.13.12, 3.14.2, and 3.14.3, then read the context in issues #142495 and pull request #142668. Review linked PRs gh-148880 and gh-148881; the work is done when the intended behavior is established and the issue has a clear conclusion or follow-up.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100