diff options
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c index e00af60ad6..797d7a95e1 100644 --- a/py/compile.c +++ b/py/compile.c @@ -293,7 +293,9 @@ STATIC mp_parse_node_t fold_constants(compiler_t *comp, mp_parse_node_t pn, mp_m // pass } else if (MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_PERCENT)) { // int%int - pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, mp_small_int_modulo(arg0, arg1)); + if (arg1 != 0) { + pn = mp_parse_node_new_leaf(MP_PARSE_NODE_SMALL_INT, mp_small_int_modulo(arg0, arg1)); + } } else { assert(MP_PARSE_NODE_IS_TOKEN_KIND(pns->nodes[1], MP_TOKEN_OP_DBL_SLASH)); // should be if (arg1 != 0) { |