Skip to content

Commit f6eab9c

Browse files
committed
lpython.py: Decode ctypes strings before returning
1 parent 3746ffd commit f6eab9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/runtime/lpython/lpython.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,10 @@ def __call__(self, *args, **kwargs):
391391
new_args.append(arg.ctypes.data_as(ctypes.POINTER(convert_numpy_dtype_to_ctype(arg.dtype))))
392392
else:
393393
new_args.append(arg)
394-
return self.cf(*new_args)
394+
res = self.cf(*new_args)
395+
if self.cf.restype == ctypes.c_char_p:
396+
res = res.decode("utf-8")
397+
return res
395398

396399
def convert_to_ctypes_Union(f):
397400
fields = []

0 commit comments

Comments
 (0)