py: Introduce and use mp_raise_type_arg helper.

To reduce code size.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-07-14 22:56:52 +10:00
parent bb00125aaa
commit 38a204ed96
10 changed files with 21 additions and 17 deletions

View File

@@ -43,8 +43,7 @@ void *mp_pystack_alloc(size_t n_bytes) {
#endif
if (MP_STATE_THREAD(pystack_cur) + n_bytes > MP_STATE_THREAD(pystack_end)) {
// out of memory in the pystack
nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError,
MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted)));
mp_raise_type_arg(&mp_type_RuntimeError, MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted));
}
void *ptr = MP_STATE_THREAD(pystack_cur);
MP_STATE_THREAD(pystack_cur) += n_bytes;