summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/obj.c b/py/obj.c
index 9efa0f05ae..db4dd770fc 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -192,10 +192,16 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) {
return mp_obj_str_equal(o1, o2);
} else {
// a string is never equal to anything else
- return false;
+ goto str_cmp_err;
}
} else if (MP_OBJ_IS_STR(o2)) {
// o1 is not a string (else caught above), so the objects are not equal
+ str_cmp_err:
+ #if MICROPY_PY_STR_BYTES_CMP_WARN
+ if (MP_OBJ_IS_TYPE(o1, &mp_type_bytes) || MP_OBJ_IS_TYPE(o2, &mp_type_bytes)) {
+ mp_warning("BytesWarning: Comparison between bytes and str");
+ }
+ #endif
return false;
}