Skip to content

The error messages of dict() and dict().update() should say positional argument instead of only argument #137626

@hyperkai

Description

@hyperkai

Setting 2 positional arguments to dict() and dict().update() gets the error messages saying only argument as shown below:

dict('John', 36)
dict().update('John', 36)
# Error

TypeError: dict expected at most 1 argument, got 2

TypeError: update expected at most 1 argument, got 2

But the error messages should say positional argument instead of only argument as shown below:

TypeError: dict expected at most 1 positional argument, got 2

TypeError: update expected at most 1 positional argument, got 2

Because setting 2 keyword arguments to dict() works as shown below:

dict(name='John', age=36)
dict().update(name='John', age=36)
# No error

Linked PRs

Metadata

Metadata

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions