@@ -538,6 +538,7 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
538538 // Exposed Getters
539539 function Get_ClassName (Acontext : Pointer) : PPyObject; cdecl;
540540 function Get_Owned (Acontext : Pointer) : PPyObject; cdecl;
541+ function Set_Owned (AValue: PPyObject; AContext: Pointer): Integer;
541542 function Get_Bound (Acontext : Pointer) : PPyObject; cdecl;
542543 // implementation of interface IFreeNotificationSubscriber
543544 procedure Notify (ADeletedObject : TObject);
@@ -2496,7 +2497,7 @@ class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
24962497 ' Returns the TObject.ClassName' , nil );
24972498 AddGetSet(' __bound__' , @TPyDelphiObject.Get_Bound, nil ,
24982499 ' Returns True if the wrapper is still bound to the Delphi instance.' , nil );
2499- AddGetSet(' __owned__' , @TPyDelphiObject.Get_Owned, nil ,
2500+ AddGetSet(' __owned__' , @TPyDelphiObject.Get_Owned, @TPyDelphiObject.Set_Owned ,
25002501 ' Returns True if the wrapper owns the Delphi instance.' , nil );
25012502 end ;
25022503end ;
@@ -2743,6 +2744,21 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
27432744 end ;
27442745end ;
27452746
2747+ function TPyDelphiObject.Set_Owned (AValue: PPyObject;
2748+ AContext: Pointer): Integer;
2749+ var
2750+ _value : Boolean;
2751+ begin
2752+ Adjust(@Self);
2753+ if CheckBoolAttribute(AValue, ' __owned__' , _value) then
2754+ begin
2755+ Owned := _value;
2756+ Result := 0 ;
2757+ end
2758+ else
2759+ Result := -1 ;
2760+ end ;
2761+
27462762function TPyDelphiObject.SqAssItem (idx: NativeInt; obj: PPyObject): integer;
27472763begin
27482764 if HasContainerAccessClass then
0 commit comments