From: Benjamin Peterson Date: Sun, 21 Mar 2010 20:30:30 +0000 (+0000) Subject: take into account keyword arguments when passing too many args X-Git-Tag: v2.7b1~268 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb9d726357854a8dcae597e22d02f5d3a2122431;p=thirdparty%2FPython%2Fcpython.git take into account keyword arguments when passing too many args --- diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py index bb922c884d67..950ac28e7291 100644 --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -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 diff --git a/Python/ceval.c b/Python/ceval.c index 4b0ff7ee2272..339a35163659 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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;