Skip to content

Commit

Permalink
esp32/modsocket: Use mp_obj_is_integer to test port type.
Browse files Browse the repository at this point in the history
Because the value may be a big integer, which is still a valid type to use.

Fixes issue #9410.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Sep 25, 2022
1 parent e6d3513 commit 3abcfb9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ports/esp32/modsocket.c
Expand Up @@ -214,7 +214,7 @@ static int _socket_getaddrinfo2(const mp_obj_t host, const mp_obj_t portx, struc
};

mp_obj_t port = portx;
if (mp_obj_is_small_int(port)) {
if (mp_obj_is_integer(port)) {
// This is perverse, because lwip_getaddrinfo promptly converts it back to an int, but
// that's the API we have to work with ...
port = mp_obj_str_binary_op(MP_BINARY_OP_MODULO, mp_obj_new_str_via_qstr("%s", 2), port);
Expand Down

0 comments on commit 3abcfb9

Please sign in to comment.