aboutsummaryrefslogtreecommitdiff
path: root/py/modthread.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-04-23 12:24:44 +0000
committerDamien George <damien.p.george@gmail.com>2016-06-28 11:28:48 +0100
commit3eb7a268091ef68248d58ddb3ad11465f1cb2199 (patch)
tree7d90365a36cbeca18220099fe2177e7636f2ad9b /py/modthread.c
parenta791be936a79154a1b1e600e5e75d147396847f6 (diff)
py/modthread: Properly cast concrete exception pointer to an object.
Diffstat (limited to 'py/modthread.c')
-rw-r--r--py/modthread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/modthread.c b/py/modthread.c
index 5104ef127..5d01fe601 100644
--- a/py/modthread.c
+++ b/py/modthread.c
@@ -80,14 +80,15 @@ STATIC void *thread_entry(void *args_in) {
} else {
// uncaught exception
// check for SystemExit
- if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) {
+ mp_obj_base_t *exc = (mp_obj_base_t*)nlr.ret_val;
+ if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(exc->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
// swallow exception silently
} else {
// print exception out
mp_printf(&mp_plat_print, "Unhandled exception in thread started by ");
mp_obj_print_helper(&mp_plat_print, args->fun, PRINT_REPR);
mp_printf(&mp_plat_print, "\n");
- mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
+ mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(exc));
}
}