@@ -763,8 +763,36 @@ public static extern int Py_Main(
763
763
[ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
764
764
internal static extern IntPtr PyEval_EvalCode( IntPtr co , IntPtr globals , IntPtr locals ) ;
765
765
766
+ #if PYTHON2
767
+ [ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
768
+ internal static 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
+ internal static 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
+ internal static 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>
766
793
[ DllImport ( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
767
- internal static 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
768
796
769
797
[ DllImport( _PythonDll , CallingConvention = CallingConvention . Cdecl ) ]
770
798
internal static extern IntPtr PyImport_ExecCodeModule( string name , IntPtr code ) ;
0 commit comments