Skip to content

Support frozendict in various builtins #145118

Description

@rhettinger

The type, str.maketrans, and bytes.maketrans builtins should support frozendict. The issues with exec and eval were reported in a separate issue.

>>> type("MyClass", (), {"x": 10})
<class '__main__.MyClass'>
                    
>>> type("MyClass", (), frozendict({"x": 10}))
Traceback (most recent call last):
  File "<pyshell#30>", line 1, in <module>
    MyClass = type("MyClass", (), frozendict({"x": 10}))
TypeError: type.__new__() argument 3 must be dict, not frozendict

>>> str.maketrans(dict({'a': 'A'}))
{97: 'A'}

>>> str.maketrans(frozendict({'a': 'A'}))
Traceback (most recent call last):
  File "<pyshell#23>", line 1, in <module>
    str.maketrans(frozendict({'a': 'A'}))
TypeError: if you give only one argument to maketrans it must be a dict

Linked PRs

Activity

  1. changed the title [-]Support frozendict is various builtins[/-] [+]Support frozendict in various builtins[/+] on Feb 22, 2026
  2. added a commit that references this issue on Feb 23, 2026
  3. added a commit that references this issue on Feb 28, 2026
  4. added a commit that references this issue on Mar 2, 2026
  5. vstinner commented on Mar 3, 2026

    @vstinner
    Member

    The type, str.maketrans, and bytes.maketrans builtins should support frozendict.

    It's now done, I close the issue.

  6. added 2 commits that reference this issue on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions