mirror of
https://github.com/micropython/micropython.git
synced 2025-08-17 16:10:33 +02:00
extmod/modwebsocket: Properly check number of args to constructor.
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "py/nlr.h"
|
#include "py/nlr.h"
|
||||||
#include "py/obj.h"
|
#include "py/obj.h"
|
||||||
|
#include "py/runtime.h"
|
||||||
#include "py/stream.h"
|
#include "py/stream.h"
|
||||||
|
|
||||||
#if MICROPY_PY_WEBSOCKET
|
#if MICROPY_PY_WEBSOCKET
|
||||||
@@ -50,7 +51,7 @@ typedef struct _mp_obj_websocket_t {
|
|||||||
} 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) {
|
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);
|
mp_obj_websocket_t *o = m_new_obj(mp_obj_websocket_t);
|
||||||
o->base.type = type;
|
o->base.type = type;
|
||||||
o->sock = args[0];
|
o->sock = args[0];
|
||||||
|
Reference in New Issue
Block a user