summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-01 22:59:15 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-01 23:22:11 +0300
commit5ba58f4a1a417d9dad1f6136cf7ff10a8935fc20 (patch)
tree352abc1be6da2daa2b555b76278e0368a3647c42 /py
parentc3103b55c1cbd6d28ff5ef310a4e731780ff391a (diff)
downloadmicropython-5ba58f4a1a417d9dad1f6136cf7ff10a8935fc20.tar.gz
micropython-5ba58f4a1a417d9dad1f6136cf7ff10a8935fc20.zip
objgenerator: Fix check for too few args passed to gen function.
Diffstat (limited to 'py')
-rw-r--r--py/objfun.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/py/objfun.c b/py/objfun.c
index f4d9dfb95e..37525210e8 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -194,8 +194,12 @@ bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, co
if (n_args > self->n_pos_args) {
goto arg_error;
} else {
- extra_args -= self->n_pos_args - n_args;
- n_extra_args += self->n_pos_args - n_args;
+ if (n_args >= self->n_pos_args - self->n_def_args) {
+ extra_args -= self->n_pos_args - n_args;
+ n_extra_args += self->n_pos_args - n_args;
+ } else {
+ fun_pos_args_mismatch(self, self->n_pos_args - self->n_def_args, n_args);
+ }
}
*out_args1 = args;
*out_args1_len = n_args;