diff options
-rw-r--r-- | py/obj.c | 2 | ||||
-rw-r--r-- | py/repl.c | 2 | ||||
-rw-r--r-- | py/runtime.c | 4 | ||||
-rw-r--r-- | py/showbc.c | 16 | ||||
-rw-r--r-- | stm/usart.c | 6 |
5 files changed, 21 insertions, 9 deletions
@@ -117,6 +117,8 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) { } else if (MP_OBJ_IS_TYPE(o1, &str_type) && MP_OBJ_IS_TYPE(o2, &str_type)) { return mp_obj_str_get(o1) == mp_obj_str_get(o2); } else { + // TODO: Debugging helper + printf("Equality for '%s' and '%s' types not yet implemented\n", mp_obj_get_type_str(o1), mp_obj_get_type_str(o2)); assert(0); return false; } @@ -20,7 +20,7 @@ bool mp_repl_is_compound_stmt(const char *line) { str_startswith_word(line, "if") || str_startswith_word(line, "while") || str_startswith_word(line, "for") - || str_startswith_word(line, "true") + || str_startswith_word(line, "try") || str_startswith_word(line, "with") || str_startswith_word(line, "def") || str_startswith_word(line, "class") diff --git a/py/runtime.c b/py/runtime.c index 795cc4624c..3ec47a9ed5 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -536,7 +536,9 @@ mp_obj_t rt_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { } // TODO specify in error message what the operator is - nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, "unsupported operand type for binary operator: '%s'", mp_obj_get_type_str(lhs))); + nlr_jump(mp_obj_new_exception_msg_varg(MP_QSTR_TypeError, + "unsupported operand types for binary operator: '%s', '%s'", + mp_obj_get_type_str(lhs), mp_obj_get_type_str(rhs))); } mp_obj_t rt_compare_op(int op, mp_obj_t lhs, mp_obj_t rhs) { diff --git a/py/showbc.c b/py/showbc.c index aea0aff67a..4ea0dd77e6 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -58,6 +58,11 @@ void mp_show_byte_code(const byte *ip, int len) { printf("LOAD_CONST_SMALL_INT %d", (int)unum); break; + case MP_BC_LOAD_CONST_INT: + DECODE_QSTR; + printf("LOAD_CONST_INT %s", qstr_str(qstr)); + break; + /* case MP_BC_LOAD_CONST_DEC: DECODE_QSTR; @@ -174,13 +179,9 @@ void mp_show_byte_code(const byte *ip, int len) { printf("POP_TOP"); break; - /* case MP_BC_ROT_TWO: - obj1 = sp[0]; - sp[0] = sp[1]; - sp[1] = obj1; + printf("ROT_TWO"); break; - */ case MP_BC_ROT_THREE: printf("ROT_THREE"); @@ -343,6 +344,11 @@ void mp_show_byte_code(const byte *ip, int len) { printf("RETURN_VALUE"); break; + case MP_BC_RAISE_VARARGS: + unum = *ip++; + printf("RAISE_VARARGS " UINT_FMT, unum); + break; + case MP_BC_YIELD_VALUE: printf("YIELD_VALUE"); break; diff --git a/stm/usart.c b/stm/usart.c index 9adc7d6ae3..bc5bfc7369 100644 --- a/stm/usart.c +++ b/stm/usart.c @@ -205,8 +205,10 @@ static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) { static mp_obj_t usart_obj_tx_str(mp_obj_t self_in, mp_obj_t s) { pyb_usart_obj_t *self = self_in; if (self->is_enabled) { - //usart_tx_str(self->usart_id, mp_obj_get_str(s)); - usart_tx_str(self->usart_id, "test"); + if (MP_OBJ_IS_TYPE(s, &str_type)) { + const char *str = qstr_str(mp_obj_get_qstr(s)); + usart_tx_str(self->usart_id, str); + } } return mp_const_none; } |