diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-10 01:19:28 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-10-10 01:20:48 +0300 |
commit | 7381b7ac71b3590140620d125c72625ac48ec30a (patch) | |
tree | 9de03b19a7e0b8854f90a03610289e81c756a381 /unix/modjni.c | |
parent | 0e87bc7be69c60581324e23163f14a269d33fcc7 (diff) |
unix/modjni: py2jvalue: Support bool and None values.
Diffstat (limited to 'unix/modjni.c')
-rw-r--r-- | unix/modjni.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/unix/modjni.c b/unix/modjni.c index 7588f46ca..0ffcb9969 100644 --- a/unix/modjni.c +++ b/unix/modjni.c @@ -352,6 +352,18 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) { } mp_obj_jobject_t *jo = arg; out->l = jo->obj; + } else if (type == &mp_type_bool) { + if (IMATCH(arg_type, "boolean")) { + out->z = arg == mp_const_true; + } else { + return false; + } + } else if (arg == mp_const_none) { + //printf("TODO: Check java arg type!!\n"); + while (isalpha(*arg_type) || *arg_type == '.') { + arg_type++; + } + out->l = NULL; } else { nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "arg type not supported")); } |