summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-06-03 16:10:12 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-06-03 16:11:53 +0300
commit43f58386e0686943c053d529a1e5f39ba5d7e3ad (patch)
tree9e8f19ec375262e274a4412fd310bbb12a3a9528
parentf245f5d7cc62ae60c73d51d9962a995ff3e579c5 (diff)
downloadmicropython-43f58386e0686943c053d529a1e5f39ba5d7e3ad.tar.gz
micropython-43f58386e0686943c053d529a1e5f39ba5d7e3ad.zip
zephyr/modusocket: getaddrinfo: Fix mp_obj_len() usage.
Return value is mp_obj_t, so needs to be accessed using MP_OBJ_SMALL_INT_VALUE().
-rw-r--r--zephyr/modusocket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/zephyr/modusocket.c b/zephyr/modusocket.c
index 0a54ea576c..cec0eec7c4 100644
--- a/zephyr/modusocket.c
+++ b/zephyr/modusocket.c
@@ -587,7 +587,8 @@ STATIC mp_obj_t mod_getaddrinfo(size_t n_args, const mp_obj_t *args) {
// Raise error only if there's nothing to return, otherwise
// it may be IPv4 vs IPv6 differences.
- if (state.status != 0 && mp_obj_len(state.result) == 0) {
+ mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(state.result));
+ if (state.status != 0 && len == 0) {
mp_raise_OSError(state.status);
}