From 05ba2433f69c4c64bff78f41fc7c77c87e42ac34 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 8 Apr 2016 16:05:48 +0300 Subject: [PATCH] extmod/modwebsocket: Properly check number of args to constructor. --- extmod/modwebsocket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 34ed46a6ef..00ec5ee980 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -31,6 +31,7 @@ #include "py/nlr.h" #include "py/obj.h" +#include "py/runtime.h" #include "py/stream.h" #if MICROPY_PY_WEBSOCKET @@ -50,7 +51,7 @@ typedef struct _mp_obj_websocket_t { } mp_obj_websocket_t; STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - assert(n_args == 1); + mp_arg_check_num(n_args, n_kw, 1, 1, false); mp_obj_websocket_t *o = m_new_obj(mp_obj_websocket_t); o->base.type = type; o->sock = args[0];