File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -5077,7 +5077,7 @@ function TPythonEngine.EncodeString(const str: UnicodeString): AnsiString; {$IFD
5077
5077
{ $IFDEF FPC}
5078
5078
function TPythonEngine.EncodeString (const str: AnsiString): AnsiString; overload;
5079
5079
begin
5080
- Result := str;
5080
+ Result := UTF8Encode( str) ;
5081
5081
end ;
5082
5082
{ $ENDIF}
5083
5083
@@ -6718,7 +6718,7 @@ procedure TError.RaiseError( const msg : AnsiString );
6718
6718
begin
6719
6719
Owner.Owner.CheckEngine;
6720
6720
with Owner.Owner.Engine do
6721
- PyErr_SetString( Error, PAnsiChar(msg) );
6721
+ PyErr_SetString(Error, PAnsiChar(EncodeString( msg)) );
6722
6722
end ;
6723
6723
6724
6724
procedure TError.RaiseErrorObj ( const msg : AnsiString; obj : PPyObject );
@@ -6769,7 +6769,8 @@ procedure TError.RaiseErrorObj( const msg : AnsiString; obj : PPyObject );
6769
6769
end
6770
6770
else
6771
6771
raise Exception.Create(' TError.RaiseErrorObj: I didn'' t get an instance' );
6772
- PyErr_SetObject( Error, res );
6772
+ PyErr_SetObject(Error, res);
6773
+ Py_XDECREF(res);
6773
6774
end
6774
6775
else
6775
6776
PyErr_SetObject( Error, obj );
@@ -7223,7 +7224,7 @@ function TPyObject.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
7223
7224
begin
7224
7225
Result := -1 ;
7225
7226
PyErr_SetString (PyExc_AttributeError^,
7226
- PAnsiChar(AnsiString (Format(' Unknown attribute "%s"' ,[key]))));
7227
+ PAnsiChar(EncodeString (Format(' Unknown attribute "%s"' ,[key]))));
7227
7228
end ;
7228
7229
end ;
7229
7230
You can’t perform that action at this time.
0 commit comments