The `type`, `str.maketrans`, and `bytes.maketrans` builtins should support `frozendict`. The issues with `exec` and `eval` were reported in a separate issue. ```python >>> 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 ``` <!-- gh-linked-prs --> ### Linked PRs * gh-145124 * gh-145129 <!-- /gh-linked-prs -->
Activity
[-]Support frozendict is various builtins[/-][+]Support frozendict in various builtins[/+]gh-145118: Add `frozendict` support to `str.maketrans()` (gh-145129)
pythongh-145118: Add `frozendict` support to `str.maketrans()` (pytho…
gh-145118: Add `frozendict` support to `type()` (#145124)
vstinner commentedon Mar 3, 2026
It's now done, I close the issue.
pythongh-145118: Add `frozendict` support to `str.maketrans()` (pytho…
pythongh-145118: Add `frozendict` support to `type()` (python#145124)