Skip to content

Commit 6196aa4

Browse files
committed
unix/modjni: jvalue2py: Handle boolean.
1 parent 1501829 commit 6196aa4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

unix/modjni.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,12 @@ STATIC bool py2jvalue(const char **jtypesig, mp_obj_t arg, jvalue *out) {
242242
// it.
243243
#define MATCH(s, static) (!strncmp(s, static, sizeof(static) - 1))
244244
STATIC mp_obj_t jvalue2py(const char *jtypesig, jobject arg) {
245+
const char *org_jtype = jtypesig;
245246
mp_obj_t ret;
246247
if (arg == NULL || MATCH(jtypesig, "void")) {
247248
return mp_const_none;
249+
} else if (MATCH(jtypesig, "boolean")) {
250+
return mp_obj_new_bool((bool)arg);
248251
} else if (MATCH(jtypesig, "int")) {
249252
return mp_obj_new_int((mp_int_t)arg);
250253
} else if (MATCH(jtypesig, "java.lang.String")) {
@@ -269,7 +272,7 @@ ret_string:;
269272
}
270273
}
271274

272-
printf("Unknown return type: %s\n", jtypesig);
275+
printf("Unknown return type: %s\n", org_jtype);
273276

274277
return MP_OBJ_NULL;
275278
}

0 commit comments

Comments
 (0)