py/runtime: mp_raise_msg(): Accept NULL argument for message.
In this case, raise an exception without a message. This would allow to shove few code bytes comparing to currently used mp_raise_msg(..., "") pattern. (Actual savings depend on function code alignment used by a particular platform.)
This commit is contained in:
parent
6771adc75f
commit
4b3da60324
@ -1431,8 +1431,12 @@ void *m_malloc_fail(size_t num_bytes) {
|
||||
}
|
||||
|
||||
NORETURN void mp_raise_msg(const mp_obj_type_t *exc_type, const char *msg) {
|
||||
if (msg == NULL) {
|
||||
nlr_raise(mp_obj_new_exception(exc_type));
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(exc_type, msg));
|
||||
}
|
||||
}
|
||||
|
||||
NORETURN void mp_raise_ValueError(const char *msg) {
|
||||
mp_raise_msg(&mp_type_ValueError, msg);
|
||||
|
Loading…
Reference in New Issue
Block a user