Skip to content

Commit

Permalink
fixes Python string assignment to [B definition with signed char.
Browse files Browse the repository at this point in the history
  • Loading branch information
tito committed Feb 6, 2015
1 parent 627bdc6 commit 770f482
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions jnius/jnius.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ from libc.stdlib cimport malloc, free
from functools import partial
import sys
import traceback
import struct

include "jni.pxi"
include "config.pxi"
Expand Down
4 changes: 2 additions & 2 deletions jnius/jnius_conversion.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ cdef void populate_args(JNIEnv *j_env, tuple definition_args, jvalue *j_args, ar
if py_arg is None:
j_args[index].l = NULL
continue
if isinstance(py_arg, basestring):
if isinstance(py_arg, (basestring, bytearray)):
if argtype == '[B':
py_arg = map(ord, py_arg)
py_arg = struct.unpack("{}b".format(len(py_arg)), py_arg)
elif argtype == '[C':
py_arg = list(py_arg)
if isinstance(py_arg, ByteArray) and argtype != '[B':
Expand Down

0 comments on commit 770f482

Please sign in to comment.