diff options
Diffstat (limited to 'py/objfilter.c')
| -rw-r--r-- | py/objfilter.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/py/objfilter.c b/py/objfilter.c index 6696ffe32..18225ac10 100644 --- a/py/objfilter.c +++ b/py/objfilter.c @@ -1,8 +1,10 @@ #include <stdlib.h> #include <assert.h> +#include "nlr.h" #include "misc.h" #include "mpconfig.h" +#include "mpqstr.h" #include "obj.h" #include "runtime.h" @@ -14,8 +16,11 @@ typedef struct _mp_obj_filter_t { static mp_obj_t filter_make_new(mp_obj_t type_in, int n_args, const mp_obj_t *args) { /* NOTE: args are backwards */ - mp_obj_filter_t *o = m_new_obj(mp_obj_filter_t); + if (n_args != 2) { + nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "filter expected 2 arguments")); + } assert(n_args == 2); + mp_obj_filter_t *o = m_new_obj(mp_obj_filter_t); o->base.type = &filter_type; o->fun = args[1]; o->iter = rt_getiter(args[0]); |
