summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/py/obj.c b/py/obj.c
index e4bf7d7dfd..437346b62d 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -357,7 +357,12 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) {
} else {
mp_obj_type_t *type = mp_obj_get_type(o_in);
if (type->unary_op != NULL) {
- return type->unary_op(MP_UNARY_OP_LEN, o_in);
+ mp_obj_t val = type->unary_op(MP_UNARY_OP_LEN, o_in);
+ // TODO: Here's the case of having MP_OBJ_NOT_SUPPORTED is confusing
+ if (val == MP_OBJ_NOT_SUPPORTED) {
+ return MP_OBJ_NULL;
+ }
+ return val;
} else {
return MP_OBJ_NULL;
}