summaryrefslogtreecommitdiff
path: root/py/compile.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-03-31 12:01:09 +0100
committerDamien George <damien.p.george@gmail.com>2014-03-31 12:01:09 +0100
commit1aa2c1026348b057dca2008a165c6d4341a66606 (patch)
tree2ff1af1263d3947631e1af33697393e699f6d383 /py/compile.c
parent523b575039d96d63669ad8c1fa318ba4db046aca (diff)
parent6ded55a61f6bbf007d518fc4531287de08fe51c4 (diff)
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c
index b2000d5b0..dc5a8b38a 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -145,7 +145,9 @@ mp_parse_node_t fold_constants(mp_parse_node_t pn) {
} else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_PERCENT)) {
pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, python_modulo(arg0, arg1));
} else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_DBL_SLASH)) {
- pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, python_floor_divide(arg0, arg1));
+ if (arg1 != 0) {
+ pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, python_floor_divide(arg0, arg1));
+ }
} else {
// shouldn't happen
assert(0);