Thanks to visit codestin.com
Credit goes to github.com

Skip to content

publicize GetDllPath + option to use latest DLL + exec and eval accept utf8 code #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions PythonForDelphi/Components/Sources/Core/PythonEngine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -5282,12 +5282,12 @@ function TPythonEngine.Run_CommandAsObjectWithDict(const command : AnsiString; m

procedure TPythonEngine.ExecStrings( strings : TStrings );
begin
Py_XDecRef( Run_CommandAsObject( CleanString( AnsiString(strings.Text) ), file_input ) );
Py_XDecRef( Run_CommandAsObject( CleanString( UTF8Encode(strings.Text) ), file_input ) );
end;

function TPythonEngine.EvalStrings( strings : TStrings ) : PPyObject;
begin
Result := Run_CommandAsObject( CleanString( AnsiString(strings.Text) ), eval_input );
Result := Run_CommandAsObject( CleanString( UTF8Encode(strings.Text) ), eval_input );
end;

procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals : PPyObject );
Expand All @@ -5297,7 +5297,7 @@ procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals :

procedure TPythonEngine.ExecStrings( strings : TStrings; locals, globals : PPyObject );
begin
Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( AnsiString(strings.Text) ), file_input, locals, globals ) );
Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( UTF8Encode(strings.Text) ), file_input, locals, globals ) );
end;

function TPythonEngine.EvalString( const command : AnsiString; locals, globals : PPyObject ) : PPyObject;
Expand All @@ -5307,12 +5307,12 @@ function TPythonEngine.EvalString( const command : AnsiString; locals, globals :

function TPythonEngine.EvalStrings( strings : TStrings; locals, globals : PPyObject ) : PPyObject;
begin
Result := Run_CommandAsObjectWithDict( CleanString( AnsiString(strings.Text) ), eval_input, locals, globals );
Result := Run_CommandAsObjectWithDict( CleanString( UTF8Encode(strings.Text) ), eval_input, locals, globals );
end;

function TPythonEngine.EvalStringsAsStr( strings : TStrings ) : String;
begin
Result := Run_CommandAsString( CleanString( AnsiString(strings.Text) ), eval_input );
Result := Run_CommandAsString( CleanString( UTF8Encode(strings.Text) ), eval_input );
end;

function TPythonEngine.CheckEvalSyntax( const str : AnsiString ) : Boolean;
Expand Down