python / python/cpython

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

Đang mở
#137,626 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@serhiy-storchaka đang làm issue này rồi.

Từ ngày 26/8/2025.

interpreter-core type-bug
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

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
  • gh-137721

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.