summaryrefslogtreecommitdiff
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-11-19 16:05:40 +0000
committerGuido van Rossum <guido@python.org>1997-11-19 16:05:40 +0000
commit0c1ea26917d25a9b640a120b7e1e1fd034077188 (patch)
tree47bb882933cd8f573d19000cea3da16becaf8ca5 /Python/ceval.c
parent0db57aca5736b4bae14f475bc0af95c8f479f2bb (diff)
downloadcpython-0c1ea26917d25a9b640a120b7e1e1fd034077188.tar.gz
Give more detailed error message when the argument count isn't right.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index fb179d1aa6..fad8c2bf58 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -454,8 +454,9 @@ eval_code2(co, globals, locals,
}
if (argcount > co->co_argcount) {
if (!(co->co_flags & CO_VARARGS)) {
- PyErr_SetString(PyExc_TypeError,
- "too many arguments");
+ PyErr_Format(PyExc_TypeError,
+ "too many arguments; expected %d, got %d",
+ co->co_argcount, argcount);
goto fail;
}
n = co->co_argcount;
@@ -513,8 +514,9 @@ eval_code2(co, globals, locals,
int m = co->co_argcount - defcount;
for (i = argcount; i < m; i++) {
if (GETLOCAL(i) == NULL) {
- PyErr_SetString(PyExc_TypeError,
- "not enough arguments");
+ PyErr_Format(PyExc_TypeError,
+ "not enough arguments; expected %d, got %d",
+ m, i);
goto fail;
}
}