summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-01-16 17:47:07 +0000
committerDamien George <damien.p.george@gmail.com>2015-01-16 17:47:07 +0000
commit963a5a3e82ded7ee75adae72ae7cb14796fa150e (patch)
tree78402c85b98c1c8f1889d7af7dc6f4828a8f55a5 /py/obj.c
parentf12ea7c7ed1ef97ee48c4356dbbc808cc2bdee4a (diff)
downloadmicropython-963a5a3e82ded7ee75adae72ae7cb14796fa150e.tar.gz
micropython-963a5a3e82ded7ee75adae72ae7cb14796fa150e.zip
py, unix: Allow to compile with -Wsign-compare.
See issue #699.
Diffstat (limited to 'py/obj.c')
-rw-r--r--py/obj.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/obj.c b/py/obj.c
index 1133914bb9..b35ed57c15 100644
--- a/py/obj.c
+++ b/py/obj.c
@@ -393,11 +393,11 @@ mp_uint_t mp_get_index(const mp_obj_type_t *type, mp_uint_t len, mp_obj_t index,
if (is_slice) {
if (i < 0) {
i = 0;
- } else if (i > len) {
+ } else if ((mp_uint_t)i > len) {
i = len;
}
} else {
- if (i < 0 || i >= len) {
+ if (i < 0 || (mp_uint_t)i >= len) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
nlr_raise(mp_obj_new_exception_msg(&mp_type_IndexError, "index out of range"));
} else {