Skip to content

Commit 6e486cc

Browse files
committed
1 parent f4ecbe3 commit 6e486cc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Demos/Demo06/Unit1.pas

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
165165
// Else check for a method
166166
Result := PyObject_GenericGetAttr(obj, PyUnicodeFromString(key));
167167
if not Assigned(Result) then
168-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
168+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format('Unknown attribute "%s"',[key]))));
169169
end;
170170
end;
171171
end;
@@ -186,7 +186,7 @@ function PyPoint_setattrfunc(obj : PPyObject; key : PAnsiChar; value : PPyObjec
186186
Result := 0;
187187
end
188188
else
189-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Attribute "%s" needs an integer',[key])));
189+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format('Attribute "%s" needs an integer',[key]))));
190190
// Check for attribute y
191191
end else if key = 'y' then begin
192192
if PyLong_Check(value) then
@@ -195,9 +195,9 @@ function PyPoint_setattrfunc(obj : PPyObject; key : PAnsiChar; value : PPyObjec
195195
Result := 0;
196196
end
197197
else
198-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Attribute "%s" needs an integer',[key])));
198+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format('Attribute "%s" needs an integer',[key]))));
199199
end else
200-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
200+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Utf8Encode(Format('Unknown attribute "%s"',[key]))));
201201
end;
202202
end;
203203

Source/PythonEngine.pas

+2-2
Original file line numberDiff line numberDiff line change
@@ -8859,10 +8859,10 @@ procedure TPythonType.Initialize;
88598859
Module.AddClient( Self );
88608860
end;
88618861
InitServices;
8862-
if Engine.PyType_Ready(TheTypePtr) <> 0 then
8863-
Engine.CheckError;
88648862
FType.tp_pythontype := Self; // Store self into FType
88658863
inherited;
8864+
if Engine.PyType_Ready(TheTypePtr) <> 0 then
8865+
Engine.CheckError;
88668866
end;
88678867

88688868
procedure TPythonType.Finalize;

0 commit comments

Comments
 (0)