From 2e6faa3faec473dd0cba340b63633c9973024552 Mon Sep 17 00:00:00 2001 From: pyscripter Date: Tue, 19 Mar 2024 17:33:27 +0000 Subject: [PATCH] Fix #464 --- Source/WrapDelphi.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/WrapDelphi.pas b/Source/WrapDelphi.pas index ba0d91e5..6ec11c1f 100644 --- a/Source/WrapDelphi.pas +++ b/Source/WrapDelphi.pas @@ -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 @@ -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