@@ -763,8 +763,36 @@ public static extern int Py_Main(
763763[ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
764764 internalstatic extern IntPtr PyEval_EvalCode( IntPtr co , IntPtr globals , IntPtr locals ) ;
765765
766+ #ifPYTHON2
767+ [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
768+ internalstatic extern IntPtr Py_CompileString( string code , string file , int start ) ;
769+ #else
770+ /// <summary>
771+ /// Return value: New reference.
772+ /// This is a simplified interface to Py_CompileStringFlags() below, leaving flags set to NULL.
773+ /// </summary>
774+ internalstatic IntPtr Py_CompileString( string str , string file , int start )
775+ {
776+ return Py_CompileStringFlags ( str , file , start , IntPtr . Zero ) ;
777+ }
778+
779+ /// <summary>
780+ /// Return value: New reference.
781+ /// This is a simplified interface to Py_CompileStringExFlags() below, with optimize set to -1.
782+ /// </summary>
783+ internalstatic IntPtr Py_CompileStringFlags( string str , string file , int start , IntPtr flags )
784+ {
785+ return Py_CompileStringExFlags( str , file , start , flags , - 1 ) ;
786+ }
787+
788+ /// <summary>
789+ /// Return value: New reference.
790+ /// Like Py_CompileStringObject(), but filename is a byte string decoded from the filesystem encoding(os.fsdecode()).
791+ /// </summary>
792+ /// <returns></returns>
766793[ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
767- internalstatic extern IntPtr Py_CompileString( string code , string file , IntPtr tok ) ;
794+ internal static extern IntPtr Py_CompileStringExFlags( string str, string file , int start , IntPtr flags , int optimize ) ;
795+ #endif
768796
769797[ DllImport( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
770798 internalstatic extern IntPtr PyImport_ExecCodeModule( string name , IntPtr code ) ;