@@ -853,19 +853,25 @@ public static extern int Py_Main(
853853 internal static extern IntPtr Py_GetBuildInfo( ) ;
854854
855855 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
856- internal static extern int PyRun_SimpleString ( string code ) ;
856+ internal static extern int PyRun_SimpleString (
857+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string code ) ;
857858
858859 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
859- internal static extern IntPtr PyRun_String( string code , IntPtr st , IntPtr globals , IntPtr locals ) ;
860+ internal static extern IntPtr PyRun_String(
861+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string code ,
862+ IntPtr st , IntPtr globals , IntPtr locals ) ;
860863
861864 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
862865 internal static extern IntPtr PyEval_EvalCode( IntPtr co , IntPtr globals , IntPtr locals ) ;
863866
864867 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
865- internal static extern IntPtr Py_CompileString( string code , string file , IntPtr tok ) ;
868+ internal static extern IntPtr Py_CompileString(
869+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string code ,
870+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string file , IntPtr tok ) ;
866871
867872 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
868- internal static extern IntPtr PyImport_ExecCodeModule( string name , IntPtr code ) ;
873+ internal static extern IntPtr PyImport_ExecCodeModule(
874+ [ MarshalAs ( UnmanagedType . CustomMarshaler , MarshalTypeRef = typeof ( Utf8Marshaler ) ) ] string name , IntPtr code ) ;
869875
870876 [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
871877 internal static extern IntPtr PyCFunction_NewEx( IntPtr ml , IntPtr self , IntPtr mod ) ;
0 commit comments