fix ctypes encoding python3
authorGP Orcullo <kinsamanka@gmail.com>
Fri, 28 Oct 2022 14:56:07 +0800
branchpython3
changeset 3756 8db203310f68
parent 3755 ca814b175391
child 3757 814595c0ea16
fix ctypes encoding
runtime/typemapping.py
--- a/runtime/typemapping.py	Fri Oct 28 14:53:23 2022 +0800
+++ b/runtime/typemapping.py	Fri Oct 28 14:56:07 2022 +0800
@@ -4,13 +4,12 @@
 # See COPYING.Runtime file for copyrights details.
 #
 
-
 import ctypes
 from ctypes import *
 from datetime import timedelta as td
 
-ctypes.pythonapi.PyString_AsString.argtypes = (ctypes.c_void_p,)
-ctypes.pythonapi.PyString_AsString.restype = ctypes.POINTER(ctypes.c_char)
+ctypes.pythonapi.PyUnicode_AsUTF8.argtypes = (ctypes.c_void_p,)
+ctypes.pythonapi.PyUnicode_AsUTF8.restype = ctypes.POINTER(ctypes.c_char)
 
 
 class IEC_STRING(Structure):