diff options
Diffstat (limited to 'unix/modffi.c')
-rw-r--r-- | unix/modffi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/unix/modffi.c b/unix/modffi.c index ba7141d242..cae16c579a 100644 --- a/unix/modffi.c +++ b/unix/modffi.c @@ -35,6 +35,7 @@ #include "py/nlr.h" #include "py/runtime.h" #include "py/binary.h" +#include "py/mperrno.h" /* * modffi uses character codes to encode a value type, based on "struct" @@ -215,7 +216,7 @@ STATIC mp_obj_t ffimod_func(size_t n_args, const mp_obj_t *args) { void *sym = dlsym(self->handle, symname); if (sym == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT))); + mp_raise_OSError(MP_ENOENT); } return make_func(args[1], sym, args[3]); } @@ -278,7 +279,7 @@ STATIC mp_obj_t ffimod_var(mp_obj_t self_in, mp_obj_t vartype_in, mp_obj_t symna void *sym = dlsym(self->handle, symname); if (sym == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT))); + mp_raise_OSError(MP_ENOENT); } mp_obj_ffivar_t *o = m_new_obj(mp_obj_ffivar_t); o->base.type = &ffivar_type; @@ -295,7 +296,7 @@ STATIC mp_obj_t ffimod_addr(mp_obj_t self_in, mp_obj_t symname_in) { void *sym = dlsym(self->handle, symname); if (sym == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOENT))); + mp_raise_OSError(MP_ENOENT); } return mp_obj_new_int((uintptr_t)sym); } @@ -312,7 +313,7 @@ STATIC mp_obj_t ffimod_make_new(const mp_obj_type_t *type, size_t n_args, size_t void *mod = dlopen(fname, RTLD_NOW | RTLD_LOCAL); if (mod == NULL) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); + mp_raise_OSError(errno); } mp_obj_ffimod_t *o = m_new_obj(mp_obj_ffimod_t); o->base.type = type; @@ -499,6 +500,5 @@ STATIC MP_DEFINE_CONST_DICT(mp_module_ffi_globals, mp_module_ffi_globals_table); const mp_obj_module_t mp_module_ffi = { .base = { &mp_type_module }, - .name = MP_QSTR_ffi, .globals = (mp_obj_dict_t*)&mp_module_ffi_globals, }; |