diff options
Diffstat (limited to 'py')
-rw-r--r-- | py/compile.c | 2 | ||||
-rw-r--r-- | py/emitpass1.c | 5 | ||||
-rw-r--r-- | py/runtime.c | 3 |
3 files changed, 5 insertions, 5 deletions
diff --git a/py/compile.c b/py/compile.c index 2e22d64262..b948f7aa47 100644 --- a/py/compile.c +++ b/py/compile.c @@ -1316,7 +1316,7 @@ void compile_nonlocal_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { void compile_assert_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) { int l_end = comp_next_label(comp); c_if_cond(comp, pns->nodes[0], true, l_end); - EMIT(load_id, MP_QSTR_AssertionError); + EMIT(load_global, MP_QSTR_AssertionError); // we load_global instead of load_id, to be consistent with CPython if (!MP_PARSE_NODE_IS_NULL(pns->nodes[1])) { // assertion message compile_node(comp, pns->nodes[1]); diff --git a/py/emitpass1.c b/py/emitpass1.c index 2f0ecac86d..60fdd0b825 100644 --- a/py/emitpass1.c +++ b/py/emitpass1.c @@ -45,10 +45,7 @@ static void emit_pass1_load_id(emit_t *emit, qstr qstr) { bool added; id_info_t *id = scope_find_or_add_id(emit->scope, qstr, &added); if (added) { - if (qstr == MP_QSTR_AssertionError) { - // TODO how much of a hack is this? - id->kind = ID_INFO_KIND_GLOBAL_EXPLICIT; - } else if (strcmp(qstr_str(qstr), "super") == 0 && emit->scope->kind == SCOPE_FUNCTION) { + if (strcmp(qstr_str(qstr), "super") == 0 && emit->scope->kind == SCOPE_FUNCTION) { // special case, super is a global, and also counts as use of __class__ id->kind = ID_INFO_KIND_GLOBAL_EXPLICIT; id_info_t *id2 = scope_find_local_in_parent(emit->scope, emit->qstr___class__); diff --git a/py/runtime.c b/py/runtime.c index 409d1d8262..8d3e900286 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -90,6 +90,7 @@ void rt_init(void) { mp_map_add_qstr(&map_builtins, MP_QSTR_SyntaxError, mp_obj_new_exception(MP_QSTR_SyntaxError)); mp_map_add_qstr(&map_builtins, MP_QSTR_ValueError, mp_obj_new_exception(MP_QSTR_ValueError)); mp_map_add_qstr(&map_builtins, MP_QSTR_OSError, mp_obj_new_exception(MP_QSTR_OSError)); + mp_map_add_qstr(&map_builtins, MP_QSTR_AssertionError, mp_obj_new_exception(MP_QSTR_AssertionError)); // built-in objects mp_map_add_qstr(&map_builtins, MP_QSTR_Ellipsis, mp_const_ellipsis); @@ -553,6 +554,8 @@ mp_obj_t rt_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { if (fit_small_int(lhs_val)) { return MP_OBJ_NEW_SMALL_INT(lhs_val); } + // TODO: return long int + assert(0); } else if (MP_OBJ_IS_TYPE(rhs, &float_type)) { return mp_obj_float_binary_op(op, lhs_val, rhs); } else if (MP_OBJ_IS_TYPE(rhs, &complex_type)) { |