@@ -2253,7 +2253,7 @@ TPythonEngine = class(TPythonInterface)
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 StringToPythonBytes (const str: string): AnsiString;
2256+ function EncodeString (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;
@@ -5136,7 +5136,7 @@ procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags);
51365136procedure TPythonEngine.SetPythonHome (const PythonHome: string);
51375137begin
51385138 FPythonHomeW := PythonHome;
5139- FPythonHome := StringToPythonBytes (PythonHome);
5139+ FPythonHome := EncodeString (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( StringToPythonBytes (strings.Text) ), file_input ) );
5311+ Py_XDecRef( Run_CommandAsObject( CleanString( EncodeString (strings.Text) ), file_input ) );
53125312end ;
53135313
53145314function TPythonEngine.EvalStrings ( strings : TStrings ) : PPyObject;
53155315begin
5316- Result := Run_CommandAsObject( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
5316+ Result := Run_CommandAsObject( CleanString( EncodeString (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( StringToPythonBytes (strings.Text) ), file_input, locals, globals ) );
5326+ Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( EncodeString (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( StringToPythonBytes (strings.Text) ), eval_input, locals, globals );
5336+ Result := Run_CommandAsObjectWithDict( CleanString( EncodeString (strings.Text) ), eval_input, locals, globals );
53375337end ;
53385338
53395339function TPythonEngine.EvalStringsAsStr ( strings : TStrings ) : String;
53405340begin
5341- Result := Run_CommandAsString( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
5341+ Result := Run_CommandAsString( CleanString( EncodeString (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.StringToPythonBytes (const str: string): AnsiString;
5689+ function TPythonEngine.EncodeString (const str: string): AnsiString;
56905690begin
56915691 if IsPython3000 then
56925692 Result := UTF8Encode(str)
0 commit comments