@@ -2246,14 +2246,14 @@   TPythonEngine = class(TPythonInterface)
22462246    procedure   Finalize ;
22472247    procedure   Lock ;
22482248    procedure   Unlock ;
2249-     procedure   SetPythonHome (PythonHome: String );
2249+     procedure   SetPythonHome (const   PythonHome: string );
22502250    function    IsType (ob: PPyObject; obt: PPyTypeObject): Boolean;
22512251    function    GetAttrString (obj: PPyObject; AName: PAnsiChar):PAnsiChar;
22522252    function    CleanString (const  s : AnsiString) : AnsiString;
22532253    function    Run_CommandAsString (const  command : AnsiString; mode : Integer) : String;
22542254    function    Run_CommandAsObject (const  command : AnsiString; mode : Integer) : PPyObject;
22552255    function    Run_CommandAsObjectWithDict (const  command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject;
2256-     function    ToPythonRawString  ( str: String ): AnsiString;
2256+     function    StringToPythonBytes  ( const   str: string ): AnsiString;
22572257    procedure   ExecString (const  command : AnsiString); overload;
22582258    procedure   ExecStrings ( strings : TStrings ); overload;
22592259    function    EvalString (const  command : AnsiString) : PPyObject; overload;
@@ -5133,10 +5133,10 @@ procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags);
51335133  end ; //  of if
51345134end ;
51355135
5136- procedure  TPythonEngine.SetPythonHome (PythonHome: String );
5136+ procedure  TPythonEngine.SetPythonHome (const   PythonHome: string );
51375137begin 
51385138  FPythonHomeW := PythonHome;
5139-   FPythonHome := ToPythonRawString (PythonHome);
5139+   FPythonHome := StringToPythonBytes (PythonHome);
51405140end ;
51415141
51425142function  TPythonEngine.IsType (ob: PPyObject; obt: PPyTypeObject): Boolean;
@@ -5308,12 +5308,12 @@ function TPythonEngine.Run_CommandAsObjectWithDict(const command : AnsiString; m
53085308
53095309procedure  TPythonEngine.ExecStrings ( strings : TStrings );
53105310begin 
5311-   Py_XDecRef( Run_CommandAsObject( CleanString( ToPythonRawString (strings.Text) ), file_input ) );
5311+   Py_XDecRef( Run_CommandAsObject( CleanString( StringToPythonBytes (strings.Text) ), file_input ) );
53125312end ;
53135313
53145314function  TPythonEngine.EvalStrings ( strings : TStrings ) : PPyObject;
53155315begin 
5316-   Result := Run_CommandAsObject( CleanString( ToPythonRawString (strings.Text) ), eval_input );
5316+   Result := Run_CommandAsObject( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
53175317end ;
53185318
53195319procedure  TPythonEngine.ExecString (const  command : AnsiString; locals, globals : PPyObject );
@@ -5323,7 +5323,7 @@ procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals :
53235323
53245324procedure  TPythonEngine.ExecStrings ( strings : TStrings; locals, globals : PPyObject );
53255325begin 
5326-   Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( ToPythonRawString (strings.Text) ), file_input, locals, globals ) );
5326+   Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( StringToPythonBytes (strings.Text) ), file_input, locals, globals ) );
53275327end ;
53285328
53295329function  TPythonEngine.EvalString ( const  command : AnsiString; locals, globals : PPyObject ) : PPyObject;
@@ -5333,12 +5333,12 @@ function TPythonEngine.EvalString( const command : AnsiString; locals, globals :
53335333
53345334function  TPythonEngine.EvalStrings ( strings : TStrings; locals, globals : PPyObject ) : PPyObject;
53355335begin 
5336-   Result := Run_CommandAsObjectWithDict( CleanString( ToPythonRawString (strings.Text) ), eval_input, locals, globals );
5336+   Result := Run_CommandAsObjectWithDict( CleanString( StringToPythonBytes (strings.Text) ), eval_input, locals, globals );
53375337end ;
53385338
53395339function  TPythonEngine.EvalStringsAsStr ( strings : TStrings ) : String;
53405340begin 
5341-   Result := Run_CommandAsString( CleanString( ToPythonRawString (strings.Text) ), eval_input );
5341+   Result := Run_CommandAsString( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
53425342end ;
53435343
53445344function  TPythonEngine.CheckEvalSyntax ( const  str : AnsiString ) : Boolean;
@@ -5686,7 +5686,7 @@ function   TPythonEngine.FindClient( const aName : string ) : TEngineClient;
56865686        end ;
56875687end ;
56885688
5689- function  TPythonEngine.ToPythonRawString  ( str: String ): AnsiString;
5689+ function  TPythonEngine.StringToPythonBytes  ( const   str: string ): AnsiString;
56905690begin 
56915691  if  IsPython3000 then 
56925692    Result := UTF8Encode(str)
0 commit comments