Skip to content

Commit d0db93c

Browse files
committed
unix/modsocket: Remove unnecessary asserts.
These checks are already made, and errors reported, by the uPy runtime.
1 parent 4d55d88 commit d0db93c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

unix/modsocket.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_htons_obj, mod_socket_htons);
391391

392392

393393
STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
394-
assert(MP_OBJ_IS_TYPE(arg, &mp_type_str));
395394
const char *s = mp_obj_str_get_str(arg);
396395
struct hostent *h = gethostbyname(s);
397396
if (h == NULL) {
@@ -441,9 +440,7 @@ STATIC mp_obj_t mod_socket_inet_ntop(mp_obj_t family_in, mp_obj_t binaddr_in) {
441440
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
442441

443442
STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
444-
// TODO: Implement all args
445-
assert(n_args >= 2 && n_args <= 4);
446-
assert(MP_OBJ_IS_STR(args[0]));
443+
// TODO: Implement 5th and 6th args
447444

448445
const char *host = mp_obj_str_get_str(args[0]);
449446
const char *serv = NULL;
@@ -510,7 +507,7 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
510507
freeaddrinfo(addr_list);
511508
return list;
512509
}
513-
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
510+
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 4, mod_socket_getaddrinfo);
514511

515512
STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
516513
mp_buffer_info_t bufinfo;

0 commit comments

Comments
 (0)