Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Support frozendict in various builtins #145118

Copy link
Copy link
@rhettinger

Description

@rhettinger
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.