From b418b6fb0d745ebaf937ae63c0c1694ea57e2922 Mon Sep 17 00:00:00 2001
From: Paul Sokolovsky <pfalcon@users.sourceforge.net>
Date: Mon, 21 Apr 2014 23:51:58 +0300
Subject: [PATCH] modffi: Don't use OSError for clearly unrelated errors.

---
 unix/modffi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/unix/modffi.c b/unix/modffi.c
index dd1001263..9dfc442b5 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -99,7 +99,7 @@ STATIC ffi_type *get_ffi_type(mp_obj_t o_in)
     }
     // TODO: Support actual libffi type objects
 
-    nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Unknown type"));
+    nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "Unknown type"));
 }
 
 STATIC mp_obj_t return_ffi_value(ffi_arg val, char type)
@@ -163,7 +163,7 @@ STATIC mp_obj_t ffimod_func(uint n_args, const mp_obj_t *args) {
 
     int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
     if (res != FFI_OK) {
-        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error in ffi_prep_cif"));
+        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
     }
 
     return o;
@@ -200,12 +200,12 @@ STATIC mp_obj_t mod_ffi_callback(mp_obj_t rettype_in, mp_obj_t func_in, mp_obj_t
 
     int res = ffi_prep_cif(&o->cif, FFI_DEFAULT_ABI, nparams, char2ffi_type(*rettype), o->params);
     if (res != FFI_OK) {
-        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error in ffi_prep_cif"));
+        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "Error in ffi_prep_cif"));
     }
 
     res = ffi_prep_closure_loc(o->clo, &o->cif, call_py_func, func_in, o->func);
     if (res != FFI_OK) {
-        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "ffi_prep_closure_loc"));
+        nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_ValueError, "ffi_prep_closure_loc"));
     }
 
     return o;
-- 
GitLab