This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect error message related to **kwargs
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.2, Python 2.7, Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: collinwinter, georg.brandl, tallpaul
Priority: normal Keywords:

Created on 2006-05-28 06:36 by collinwinter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
better_kwargs_error_msg.patch collinwinter, 2006-05-28 06:36 Improve **kwargs-related error message, against r46495
Messages (3)
msg28663 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2006-05-28 06:36
"""
>>> def foo(**kwargs):
...     pass
...
>>> foo(5, 6)
TypeError: foo() takes exactly 0 arguments (2 given)
"""

It clearly does take arguments, just not positional
arguments.

The attached patch changes the message above to "foo()
takes exactly 0 non-keyword arguments", as well as
changing the message in several other, similar cases.

The patch also updates Lib/test/output/test_extcall
appropriately.

The patch is against r46495.
msg28664 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-29 14:48
Logged In: YES 
user_id=849994

This is the same problem described in #1283289.
msg186692 - (view) Author: Paul Munday (tallpaul) Date: 2013-04-13 03:25
This wasn't fixed by   the patch for #1283289.
(Still true of at least 2.7.3 and 3.2.3)
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43424
2013-04-13 03:25:38tallpaulsettype: behavior
2013-04-13 03:25:22tallpaulsetnosy: + tallpaul

messages: + msg186692
versions: + Python 2.7, Python 3.2
2006-05-28 06:36:23collinwintercreate