Skip to content

Commit 7381b7a

Browse files
committed
unix/modjni: py2jvalue: Support bool and None values.
1 parent 0e87bc7 commit 7381b7a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

unix/modjni.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,18 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
352352
}
353353
mp_obj_jobject_t *jo = arg;
354354
out->l = jo->obj;
355+
} else if (type == &mp_type_bool) {
356+
if (IMATCH(arg_type, "boolean")) {
357+
out->z = arg == mp_const_true;
358+
} else {
359+
return false;
360+
}
361+
} else if (arg == mp_const_none) {
362+
//printf("TODO: Check java arg type!!\n");
363+
while (isalpha(*arg_type) || *arg_type == '.') {
364+
arg_type++;
365+
}
366+
out->l = NULL;
355367
} else {
356368
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "arg type not supported"));
357369
}

0 commit comments

Comments
 (0)