summaryrefslogtreecommitdiffstatshomepage
path: root/py/objexcept.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-02-15 22:55:00 +0000
committerDamien George <damien.p.george@gmail.com>2014-02-15 22:55:00 +0000
commitc8f78bc280447a06802d6456e8e759872e82246d (patch)
tree2faf58e60132f9f936e0274226987bda33ee5c91 /py/objexcept.c
parent36109d246fc5396c38bedfc240ddbe60a3c718fc (diff)
downloadmicropython-c8f78bc280447a06802d6456e8e759872e82246d.tar.gz
micropython-c8f78bc280447a06802d6456e8e759872e82246d.zip
py: VM never throws an exception, instead returns a status and value.
Addresses issue #290, and hopefully sets up things to allow generators throwing exceptions, etc.
Diffstat (limited to 'py/objexcept.c')
-rw-r--r--py/objexcept.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/objexcept.c b/py/objexcept.c
index dbe702fa9e..65ec533164 100644
--- a/py/objexcept.c
+++ b/py/objexcept.c
@@ -27,6 +27,7 @@ STATIC void mp_obj_exception_print(void (*print)(void *env, const char *fmt, ...
print(env, "%s: %s", qstr_str(o->base.type->name), vstr_str(o->msg));
} else {
// Yes, that's how CPython has it
+ // TODO now that exceptions are classes and instances, I think this needs to be changed to match CPython
if (kind == PRINT_REPR) {
print(env, "%s", qstr_str(o->base.type->name));
}
@@ -162,7 +163,7 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, machine_uint_t
// for traceback, we are just using the list object for convenience, it's not really a list of Python objects
if (self->traceback == MP_OBJ_NULL) {
- self->traceback = mp_obj_new_list(3, NULL);
+ self->traceback = mp_obj_new_list(0, NULL);
}
mp_obj_list_append(self->traceback, (mp_obj_t)(machine_uint_t)file);
mp_obj_list_append(self->traceback, (mp_obj_t)(machine_uint_t)line);