summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-12-16 00:28:02 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-12-16 00:28:12 +0200
commit00785613030f83516dfe3073a17c58c4657cfe89 (patch)
treefa6273f066fc96ff739442bc8c71bd293e6cb122
parent7a4765dbeb1176efc2679aeb66ce8b21a8e1fd08 (diff)
downloadmicropython-00785613030f83516dfe3073a17c58c4657cfe89.tar.gz
micropython-00785613030f83516dfe3073a17c58c4657cfe89.zip
modffi: Support void (None) return value for Python callback functions.
-rw-r--r--unix/modffi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/unix/modffi.c b/unix/modffi.c
index 21f3ca638d..d6d416a3e0 100644
--- a/unix/modffi.c
+++ b/unix/modffi.c
@@ -211,7 +211,9 @@ STATIC void call_py_func(ffi_cif *cif, void *ret, void** args, mp_obj_t func) {
}
mp_obj_t res = mp_call_function_n_kw(func, cif->nargs, 0, pyargs);
- *(ffi_arg*)ret = mp_obj_int_get_truncated(res);
+ if (res != mp_const_none) {
+ *(ffi_arg*)ret = mp_obj_int_get_truncated(res);
+ }
}
STATIC mp_obj_t mod_ffi_callback(mp_obj_t rettype_in, mp_obj_t func_in, mp_obj_t paramtypes_in) {