Kaydet (Commit) bb9d7263 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

take into account keyword arguments when passing too many args

üst 96545893
......@@ -279,6 +279,15 @@ A obscure message:
Traceback (most recent call last):
...
TypeError: f() takes exactly 2 arguments (1 given)
The number of arguments passed in includes keywords:
>>> def f(a):
... pass
>>> f(6, a=4, *(1, 2, 3))
Traceback (most recent call last):
...
TypeError: f() takes exactly 1 argument (5 given)
"""
import unittest
......
......@@ -3060,7 +3060,7 @@ PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals,
defcount ? "at most" : "exactly",
co->co_argcount,
co->co_argcount == 1 ? "" : "s",
argcount);
argcount + kwcount);
goto fail;
}
n = co->co_argcount;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment