Skip to content

defaultdict | frozendict returns dict, not defaultdict #149534

@JelleZijlstra

Description

@JelleZijlstra

Bug report

Bug description:

Compare:

>>> type(defaultdict(int) | frozendict())
<class 'dict'>
>>> type(OrderedDict() | frozendict())
<class 'collections.OrderedDict'>
>>> type(defaultdict(int) | dict())
<class 'collections.defaultdict'>

This should be fixable by making defaultdict's nb_or use PyAnyDict_Check instead of PyDict_Check.

CPython versions tested on:

3.15

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15pre-release feature fixes, bugs and security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions