@@ -469,16 +469,24 @@ public static void Exec(string code, IntPtr? globals = null, IntPtr? locals = nu
469469
470470
471471 /// <summary>
472- /// RunString Method
472+ /// RunString Method. Function has been deprecated and will be removed.
473+ /// Use Exec/Eval/RunSimpleString instead.
474+ /// </summary>
475+ [ Obsolete ( "RunString is deprecated and will be removed. Use Exec/Eval/RunSimpleString instead." ) ]
476+ public static PyObject RunString ( string code , IntPtr ? globals = null , IntPtr ? locals = null )
477+ {
478+ return RunString ( code , globals , locals , RunFlagType . File ) ;
479+ }
480+
481+ /// <summary>
482+ /// Internal RunString Method.
473483 /// </summary>
474484 /// <remarks>
475485 /// Run a string containing Python code. Returns the result of
476486 /// executing the code string as a PyObject instance, or null if
477487 /// an exception was raised.
478488 /// </remarks>
479- public static PyObject RunString (
480- string code , IntPtr ? globals = null , IntPtr ? locals = null , RunFlagType _flag = RunFlagType . File
481- )
489+ internal static PyObject RunString ( string code , IntPtr ? globals , IntPtr ? locals , RunFlagType flag )
482490 {
483491 var borrowedGlobals = true ;
484492 if ( globals == null )
@@ -502,12 +510,10 @@ public static PyObject RunString(
502510 borrowedLocals = false ;
503511 }
504512
505- var flag = ( IntPtr ) _flag ;
506-
507513 try
508514 {
509515 IntPtr result = Runtime . PyRun_String (
510- code , flag , globals . Value , locals . Value
516+ code , ( IntPtr ) flag , globals . Value , locals . Value
511517 ) ;
512518
513519 Runtime . CheckExceptionOccurred ( ) ;
0 commit comments