@@ -169,9 +169,10 @@ typedef mp_obj_t (*mp_fun_var_t)(uint n, const mp_obj_t *);
169169typedef mp_obj_t (* mp_fun_kw_t )(uint n , const mp_obj_t * , mp_map_t * );
170170
171171typedef enum {
172- PRINT_STR ,
173- PRINT_REPR ,
174- PRINT_EXC , // Special format for printing exception in unhandled exception message
172+ PRINT_STR = 0 ,
173+ PRINT_REPR = 1 ,
174+ PRINT_EXC = 2 , // Special format for printing exception in unhandled exception message
175+ PRINT_EXC_SUBCLASS = 4 , // Internal flag for printing exception subclasses
175176} mp_print_kind_t ;
176177
177178typedef void (* mp_print_fun_t )(void (* print )(void * env , const char * fmt , ...), void * env , mp_obj_t o , mp_print_kind_t kind );
@@ -424,13 +425,15 @@ mp_float_t mp_obj_int_as_float(mp_obj_t self_in);
424425machine_int_t mp_obj_int_get_checked (mp_obj_t self_in );
425426
426427// exception
428+ #define mp_obj_is_native_exception_instance (o ) (mp_obj_get_type(o)->make_new == mp_obj_exception_make_new)
427429bool mp_obj_is_exception_type (mp_obj_t self_in );
428430bool mp_obj_is_exception_instance (mp_obj_t self_in );
429431bool mp_obj_exception_match (mp_obj_t exc , const mp_obj_type_t * exc_type );
430432void mp_obj_exception_clear_traceback (mp_obj_t self_in );
431433void mp_obj_exception_add_traceback (mp_obj_t self_in , qstr file , machine_uint_t line , qstr block );
432434void mp_obj_exception_get_traceback (mp_obj_t self_in , machine_uint_t * n , machine_uint_t * * values );
433435mp_obj_t mp_obj_exception_get_value (mp_obj_t self_in );
436+ mp_obj_t mp_obj_exception_make_new (mp_obj_t type_in , uint n_args , uint n_kw , const mp_obj_t * args );
434437
435438// str
436439mp_obj_t mp_obj_str_builder_start (const mp_obj_type_t * type , uint len , byte * * data );
0 commit comments