summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-04-21 00:09:44 +0100
committerDamien George <damien.p.george@gmail.com>2014-04-21 00:09:44 +0100
commit64ba6ca1275cbb4625ebb831610fb3f241d22acc (patch)
tree6aa6da4ffb72c9b7c519931f55ed92fb4fc972a7 /py
parent643284fc8e7cec935f13c50ecde854932a28cee8 (diff)
downloadmicropython-64ba6ca1275cbb4625ebb831610fb3f241d22acc.tar.gz
micropython-64ba6ca1275cbb4625ebb831610fb3f241d22acc.zip
py: Small change to mp_arg_parse_all.
Diffstat (limited to 'py')
-rw-r--r--py/argcheck.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/argcheck.c b/py/argcheck.c
index 5c5ea1bf80..aea71d0bd8 100644
--- a/py/argcheck.c
+++ b/py/argcheck.c
@@ -40,7 +40,7 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all
mp_obj_t given_arg;
if (i < n_pos) {
if (allowed[i].flags & MP_ARG_PARSE_KW_ONLY) {
- nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' argument must be given by a keyword", qstr_str(allowed[i].qstr)));
+ goto extra_positional;
}
pos_found++;
given_arg = pos[i];
@@ -69,6 +69,7 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all
}
if (pos_found < n_pos) {
// TODO better error message
+ extra_positional:
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "extra positional arguments given"));
}
if (kws_found < kws->used) {