@@ -2253,7 +2253,7 @@ TPythonEngine = class(TPythonInterface)
2253
2253
function Run_CommandAsString (const command : AnsiString; mode : Integer) : String;
2254
2254
function Run_CommandAsObject (const command : AnsiString; mode : Integer) : PPyObject;
2255
2255
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;
2257
2257
procedure ExecString (const command : AnsiString); overload;
2258
2258
procedure ExecStrings ( strings : TStrings ); overload;
2259
2259
function EvalString (const command : AnsiString) : PPyObject; overload;
@@ -5136,7 +5136,7 @@ procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags);
5136
5136
procedure TPythonEngine.SetPythonHome (const PythonHome: string);
5137
5137
begin
5138
5138
FPythonHomeW := PythonHome;
5139
- FPythonHome := StringToPythonBytes (PythonHome);
5139
+ FPythonHome := EncodeString (PythonHome);
5140
5140
end ;
5141
5141
5142
5142
function TPythonEngine.IsType (ob: PPyObject; obt: PPyTypeObject): Boolean;
@@ -5308,12 +5308,12 @@ function TPythonEngine.Run_CommandAsObjectWithDict(const command : AnsiString; m
5308
5308
5309
5309
procedure TPythonEngine.ExecStrings ( strings : TStrings );
5310
5310
begin
5311
- Py_XDecRef( Run_CommandAsObject( CleanString( StringToPythonBytes (strings.Text) ), file_input ) );
5311
+ Py_XDecRef( Run_CommandAsObject( CleanString( EncodeString (strings.Text) ), file_input ) );
5312
5312
end ;
5313
5313
5314
5314
function TPythonEngine.EvalStrings ( strings : TStrings ) : PPyObject;
5315
5315
begin
5316
- Result := Run_CommandAsObject( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
5316
+ Result := Run_CommandAsObject( CleanString( EncodeString (strings.Text) ), eval_input );
5317
5317
end ;
5318
5318
5319
5319
procedure TPythonEngine.ExecString (const command : AnsiString; locals, globals : PPyObject );
@@ -5323,7 +5323,7 @@ procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals :
5323
5323
5324
5324
procedure TPythonEngine.ExecStrings ( strings : TStrings; locals, globals : PPyObject );
5325
5325
begin
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 ) );
5327
5327
end ;
5328
5328
5329
5329
function TPythonEngine.EvalString ( const command : AnsiString; locals, globals : PPyObject ) : PPyObject;
@@ -5333,12 +5333,12 @@ function TPythonEngine.EvalString( const command : AnsiString; locals, globals :
5333
5333
5334
5334
function TPythonEngine.EvalStrings ( strings : TStrings; locals, globals : PPyObject ) : PPyObject;
5335
5335
begin
5336
- Result := Run_CommandAsObjectWithDict( CleanString( StringToPythonBytes (strings.Text) ), eval_input, locals, globals );
5336
+ Result := Run_CommandAsObjectWithDict( CleanString( EncodeString (strings.Text) ), eval_input, locals, globals );
5337
5337
end ;
5338
5338
5339
5339
function TPythonEngine.EvalStringsAsStr ( strings : TStrings ) : String;
5340
5340
begin
5341
- Result := Run_CommandAsString( CleanString( StringToPythonBytes (strings.Text) ), eval_input );
5341
+ Result := Run_CommandAsString( CleanString( EncodeString (strings.Text) ), eval_input );
5342
5342
end ;
5343
5343
5344
5344
function TPythonEngine.CheckEvalSyntax ( const str : AnsiString ) : Boolean;
@@ -5686,7 +5686,7 @@ function TPythonEngine.FindClient( const aName : string ) : TEngineClient;
5686
5686
end ;
5687
5687
end ;
5688
5688
5689
- function TPythonEngine.StringToPythonBytes (const str: string): AnsiString;
5689
+ function TPythonEngine.EncodeString (const str: string): AnsiString;
5690
5690
begin
5691
5691
if IsPython3000 then
5692
5692
Result := UTF8Encode(str)
0 commit comments