Skip to content

Commit 81590eb

Browse files
automate conversion of lists of strings #98
1 parent 2c233d4 commit 81590eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pyray/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def makefunc(a):
4343
def func(*args):
4444
modified_args = []
4545
for (c_arg, arg) in zip(ffi.typeof(a).args, args):
46-
# print("arg:",str(arg), "c_arg.kind:", c_arg.kind, "c_arg:", c_arg, "type(arg):",str(type(arg)))
46+
#print("arg:",str(arg), "c_arg.kind:", c_arg.kind, "c_arg:", c_arg, "type(arg):",str(type(arg)))
4747
if c_arg.kind == 'pointer':
4848
if type(arg) == str:
4949
arg = arg.encode('utf-8')
@@ -53,6 +53,8 @@ def func(*args):
5353
arg = ffi.new("int *", arg)
5454
elif type(arg) is float:
5555
arg = ffi.new("float *", arg)
56+
elif type(arg) is list and str(c_arg) == "<ctype 'char * *'>":
57+
arg = [ffi.new("char[]", x.encode('utf-8')) for x in arg]
5658
elif str(type(arg)) == "<class '_cffi_backend.__CDataOwn'>" and "*" not in str(arg): # CPython
5759
arg = ffi.addressof(arg)
5860
elif str(type(arg)) == "<class '_cffi_backend._CDataBase'>" and "*" not in str(arg): # Pypy

0 commit comments

Comments
 (0)