Skip to content

Commit

Permalink
Fix #464
Browse files Browse the repository at this point in the history
  • Loading branch information
pyscripter committed Mar 19, 2024
1 parent 46e0bf7 commit 2e6faa3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/WrapDelphi.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1511,11 +1511,14 @@ function TExposedGetSet.GetterWrapper(AObj: PPyObject; AContext : Pointer): PPyO
begin
Result := nil;
if ValidateClassProperty(AObj, FParentRtti.Handle, Obj, LOutMsg) then
begin
try
if FRttiMember is TRttiProperty then
Result := GetRttiProperty(Obj, TRttiProperty(FRttiMember), FPyDelphiWrapper, LOutMsg)
else if FRttiMember is TRttiField then
Result := GetRttiField(Obj, TRttiField(FRttiMember), FPyDelphiWrapper, LOutMsg);
except
on E: Exception do
LOutMsg := E.Message;
end;

if not Assigned(Result) then
Expand All @@ -1531,13 +1534,16 @@ function TExposedGetSet.SetterWrapper(AObj, AValue: PPyObject; AContext: Pointer
begin
Result := -1;
if ValidateClassProperty(AObj, FParentRtti.Handle, Obj, ErrMsg) then
begin
try
if ((FRttiMember is TRttiProperty) and SetRttiProperty(Obj,
TRttiProperty(FRttiMember), AValue, FPyDelphiWrapper, ErrMsg)) or
((FRttiMember is TRttiField) and SetRttiField(Obj,
TRttiField(FRttiMember), AValue, FPyDelphiWrapper, ErrMsg))
then
Result := 0
except
on E: Exception do
ErrMsg := E.Message;
end;

if Result <> 0 then
Expand Down

0 comments on commit 2e6faa3

Please sign in to comment.