unix/modsocket: Remove unnecessary asserts.
These checks are already made, and errors reported, by the uPy runtime.
This commit is contained in:
parent
4d55d8805a
commit
d0db93cf1f
|
@ -391,7 +391,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_htons_obj, mod_socket_htons);
|
||||||
|
|
||||||
|
|
||||||
STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
|
STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
|
||||||
assert(MP_OBJ_IS_TYPE(arg, &mp_type_str));
|
|
||||||
const char *s = mp_obj_str_get_str(arg);
|
const char *s = mp_obj_str_get_str(arg);
|
||||||
struct hostent *h = gethostbyname(s);
|
struct hostent *h = gethostbyname(s);
|
||||||
if (h == NULL) {
|
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) {
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_socket_inet_ntop_obj, mod_socket_inet_ntop);
|
||||||
|
|
||||||
STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
|
STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
|
||||||
// TODO: Implement all args
|
// TODO: Implement 5th and 6th args
|
||||||
assert(n_args >= 2 && n_args <= 4);
|
|
||||||
assert(MP_OBJ_IS_STR(args[0]));
|
|
||||||
|
|
||||||
const char *host = mp_obj_str_get_str(args[0]);
|
const char *host = mp_obj_str_get_str(args[0]);
|
||||||
const char *serv = NULL;
|
const char *serv = NULL;
|
||||||
|
@ -510,7 +507,7 @@ STATIC mp_obj_t mod_socket_getaddrinfo(size_t n_args, const mp_obj_t *args) {
|
||||||
freeaddrinfo(addr_list);
|
freeaddrinfo(addr_list);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 6, mod_socket_getaddrinfo);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_socket_getaddrinfo_obj, 2, 4, mod_socket_getaddrinfo);
|
||||||
|
|
||||||
STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
|
STATIC mp_obj_t mod_socket_sockaddr(mp_obj_t sockaddr_in) {
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
|
|
Loading…
Reference in New Issue