Skip to content

Commit

Permalink
some sync with P4D
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Oct 8, 2024
1 parent d2d0f6d commit fda3fdb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions python4lazarus/PythonEngine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4672,7 +4672,7 @@ procedure TPythonEngine.ExecFile(const FileName: string; locals,
begin
SL := TStringList.Create;
try
SL.LoadFromFile(FileName);
SL.LoadFromFile(FileName, TEncoding.UTF8);
ExecStrings(SL, locals, globals, FileName);
finally
SL.Free;
Expand Down Expand Up @@ -5891,15 +5891,19 @@ procedure TPythonEngine.ListToSet( List : PPyObject; data : Pointer; size : Inte
end;

procedure TPythonEngine.CheckError(ACatchStopEx : Boolean = False);

procedure ProcessSystemExit;
var
errtype, errvalue, errtraceback: PPyObject;
SErrValue: string;
begin
// PyErr_Fetch clears the error. The returned python objects are new references
PyErr_Fetch(errtype, errvalue, errtraceback);
Traceback.Refresh(errtraceback);
SErrValue := PyObjectAsString(errvalue);
PyErr_Clear;
Py_XDECREF(errtype);
Py_XDECREF(errvalue);
Py_XDECREF(errtraceback);
raise EPySystemExit.CreateResFmt(@SPyExcSystemError, [SErrValue]);
end;

Expand Down

0 comments on commit fda3fdb

Please sign in to comment.