py: Add mp_raise_OSError(errno) helper function.

This is an often used code pattern, and its use reduces code size of the
core by about 100 bytes.
This commit is contained in:
Damien George
2016-10-07 13:31:59 +11:00
parent 0363e1d7b5
commit 3a0a771730
5 changed files with 16 additions and 11 deletions

View File

@@ -102,7 +102,7 @@ STATIC mp_obj_t bufwriter_flush(mp_obj_t self_in) {
assert(out_sz == self->len);
self->len = 0;
if (err != 0) {
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(err)));
mp_raise_OSError(err);
}
}