Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 6599:6d6fec2eeef6 legacy-trunk
Give more detailed error message when the argument count isn't right.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 19 Nov 1997 16:05:40 +0000 |
| parents | 67a2afcdd21c |
| children | f14e4459fb94 |
line wrap: on
line diff
--- a/Python/ceval.c Wed Nov 19 16:04:54 1997 +0000 +++ b/Python/ceval.c Wed Nov 19 16:05:40 1997 +0000 @@ -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; } }
