py: Use mp_arg_check_num in some _make_new functions.
Reduces stmhal code size by about 250 bytes.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
|
||||
typedef struct _mp_obj_filter_t {
|
||||
@@ -34,10 +33,7 @@ typedef struct _mp_obj_filter_t {
|
||||
} mp_obj_filter_t;
|
||||
|
||||
STATIC mp_obj_t filter_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
if (n_args != 2 || n_kw != 0) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, "filter expected 2 arguments"));
|
||||
}
|
||||
assert(n_args == 2);
|
||||
mp_arg_check_num(n_args, n_kw, 2, 2, false);
|
||||
mp_obj_filter_t *o = m_new_obj(mp_obj_filter_t);
|
||||
o->base.type = type_in;
|
||||
o->fun = args[0];
|
||||
|
||||
Reference in New Issue
Block a user