Skip to content

Commit 64ba6ca

Browse files
committed
py: Small change to mp_arg_parse_all.
1 parent 643284f commit 64ba6ca

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

py/argcheck.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void mp_arg_parse_all(uint n_pos, const mp_obj_t *pos, mp_map_t *kws, uint n_all
4040
mp_obj_t given_arg;
4141
if (i < n_pos) {
4242
if (allowed[i].flags & MP_ARG_PARSE_KW_ONLY) {
43-
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' argument must be given by a keyword", qstr_str(allowed[i].qstr)));
43+
goto extra_positional;
4444
}
4545
pos_found++;
4646
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
6969
}
7070
if (pos_found < n_pos) {
7171
// TODO better error message
72+
extra_positional:
7273
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "extra positional arguments given"));
7374
}
7475
if (kws_found < kws->used) {

0 commit comments

Comments
 (0)