diff --git a/py/objexcept.c b/py/objexcept.c index c1b992d276b6be53b0624057fd15c12e1631e978..76d34f56e466af38f1414319562d0bdb3b3c334b 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -383,10 +383,8 @@ mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, const char o->traceback_data = NULL; o->args = MP_OBJ_TO_PTR(mp_obj_new_tuple(1, NULL)); - if (fmt == NULL) { - // no message - assert(0); - } else { + assert(fmt != NULL); + { if (strchr(fmt, '%') == NULL) { // no formatting substitutions, avoid allocating vstr. o->args->items[0] = mp_obj_new_str(fmt, strlen(fmt), false);