Skip to content

Commit d20d8a9

Browse files
committed
Fix Demo 7
1 parent cd99272 commit d20d8a9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Demos/Demo07/Unit1.dfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ object Form1: TForm1
138138
OnInitialization = PythonType1Initialization
139139
TypeName = 'Point'
140140
Prefix = 'Create'
141-
Services.Basic = [bsGetAttrO, bsSetAttrO, bsRepr, bsStr]
141+
Services.Basic = [bsGetAttr, bsSetAttr, bsRepr, bsStr, bsTraverse]
142142
Services.InplaceNumber = []
143143
Services.Number = []
144144
Services.Sequence = []

Demos/Demo07/Unit1.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
205205
// Else check for a method
206206
Result := PyObject_GenericGetAttr(obj, PyUnicodeFromString(key));
207207
if not Assigned(Result) then
208-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
208+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown attribute "%s"',[key]))));
209209
end;
210210
end;
211211
end;
@@ -226,7 +226,7 @@ function PyPoint_setattrfunc(obj : PPyObject; key : PAnsiChar; value : PPyObjec
226226
Result := 0;
227227
end
228228
else
229-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Attribute "%s" needs an integer',[key])));
229+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Attribute "%s" needs an integer',[key]))));
230230
// Check for attribute y
231231
end else if key = 'y' then begin
232232
if PyLong_Check(value) then
@@ -235,9 +235,9 @@ function PyPoint_setattrfunc(obj : PPyObject; key : PAnsiChar; value : PPyObjec
235235
Result := 0;
236236
end
237237
else
238-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Attribute "%s" needs an integer',[key])));
238+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Attribute "%s" needs an integer',[key]))));
239239
end else
240-
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
240+
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown attribute "%s"',[key]))));
241241
end;
242242
end;
243243

0 commit comments

Comments
 (0)