Skip to content

Commit 5ba58f4

Browse files
committed
objgenerator: Fix check for too few args passed to gen function.
1 parent c3103b5 commit 5ba58f4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

py/objfun.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,12 @@ bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, co
194194
if (n_args > self->n_pos_args) {
195195
goto arg_error;
196196
} else {
197-
extra_args -= self->n_pos_args - n_args;
198-
n_extra_args += self->n_pos_args - n_args;
197+
if (n_args >= self->n_pos_args - self->n_def_args) {
198+
extra_args -= self->n_pos_args - n_args;
199+
n_extra_args += self->n_pos_args - n_args;
200+
} else {
201+
fun_pos_args_mismatch(self, self->n_pos_args - self->n_def_args, n_args);
202+
}
199203
}
200204
*out_args1 = args;
201205
*out_args1_len = n_args;

0 commit comments

Comments
 (0)