summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-15 19:09:06 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-05-15 19:09:06 +0300
commitad3baec12f2d86cda58bc2a51173c76b6c335fa2 (patch)
tree75194c4129349ae73afe213bbe423837cb22e44b /py
parent767e45c2901977a687e0def3169c6fd9f3ae3466 (diff)
downloadmicropython-ad3baec12f2d86cda58bc2a51173c76b6c335fa2.tar.gz
micropython-ad3baec12f2d86cda58bc2a51173c76b6c335fa2.zip
sequence: Fix yet another case of improper sequence comparison.
This time, in mp_seq_cmp_bytes(). How many more cases are still lurking?
Diffstat (limited to 'py')
-rw-r--r--py/sequence.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/py/sequence.c b/py/sequence.c
index 1af2ad27ef..966adaac03 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -100,6 +100,10 @@ bool mp_seq_cmp_bytes(int op, const byte *data1, uint len1, const byte *data2, u
}
uint min_len = len1 < len2 ? len1 : len2;
int res = memcmp(data1, data2, min_len);
+ if (op == MP_BINARY_OP_EQUAL) {
+ // If we are checking for equality, here're the answer
+ return res == 0;
+ }
if (res < 0) {
return false;
}