File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 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
50775077{ $IFDEF FPC}
50785078function TPythonEngine.EncodeString (const str: AnsiString): AnsiString; overload;
50795079begin
5080- Result := str;
5080+ Result := UTF8Encode( str) ;
50815081end ;
50825082{ $ENDIF}
50835083
@@ -6718,7 +6718,7 @@ procedure TError.RaiseError( const msg : AnsiString );
67186718begin
67196719 Owner.Owner.CheckEngine;
67206720 with Owner.Owner.Engine do
6721- PyErr_SetString( Error, PAnsiChar(msg) );
6721+ PyErr_SetString(Error, PAnsiChar(EncodeString( msg)) );
67226722end ;
67236723
67246724procedure TError.RaiseErrorObj ( const msg : AnsiString; obj : PPyObject );
@@ -6769,7 +6769,8 @@ procedure TError.RaiseErrorObj( const msg : AnsiString; obj : PPyObject );
67696769 end
67706770 else
67716771 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);
67736774 end
67746775 else
67756776 PyErr_SetObject( Error, obj );
@@ -7223,7 +7224,7 @@ function TPyObject.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
72237224 begin
72247225 Result := -1 ;
72257226 PyErr_SetString (PyExc_AttributeError^,
7226- PAnsiChar(AnsiString (Format(' Unknown attribute "%s"' ,[key]))));
7227+ PAnsiChar(EncodeString (Format(' Unknown attribute "%s"' ,[key]))));
72277228 end ;
72287229end ;
72297230
You can’t perform that action at this time.
0 commit comments