Give more detailed error message when the argument count isn't right.
diff --git a/Python/ceval.c b/Python/ceval.c
index fb179d1..fad8c2b 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -454,8 +454,9 @@
}
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 @@
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;
}
}