classification
Title: Not accurate error message for exact number of positional arguments
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka
Priority: normal Keywords: patch

Created on 2019-03-13 20:44 by serhiy.storchaka, last changed 2019-03-14 07:28 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 12310 merged serhiy.storchaka, 2019-03-13 20:48
Messages (2)
msg337874 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-13 20:44
Due to minor error, the error message for too many positional arguments is not accurate if the function uses Argument Clinic.

For example:

>>> int.from_bytes(b'a', 'little', False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: from_bytes() takes at most 2 positional arguments (3 given)

This is correct, but not accurate, because from_bytes() takes *exactly* 2 positional arguments.
msg337876 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-13 21:03
New changeset f2f55e7f03d332fd43bc665a86d585a79c3b3ed4 by Serhiy Storchaka in branch 'master':
bpo-36282: Improved error message for too much positional arguments. (GH-12310)
https://github.com/python/cpython/commit/f2f55e7f03d332fd43bc665a86d585a79c3b3ed4
History
Date User Action Args
2019-03-14 07:28:16serhiy.storchakasetstatus: open -> closed
type: behavior -> enhancement
resolution: fixed
stage: patch review -> resolved
2019-03-13 21:03:25serhiy.storchakasetmessages: + msg337876
2019-03-13 20:48:44serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request12285
2019-03-13 20:44:52serhiy.storchakacreate