@@ -538,6 +538,7 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
538
538
// Exposed Getters
539
539
function Get_ClassName (Acontext : Pointer) : PPyObject; cdecl;
540
540
function Get_Owned (Acontext : Pointer) : PPyObject; cdecl;
541
+ function Set_Owned (AValue: PPyObject; AContext: Pointer): Integer;
541
542
function Get_Bound (Acontext : Pointer) : PPyObject; cdecl;
542
543
// implementation of interface IFreeNotificationSubscriber
543
544
procedure Notify (ADeletedObject : TObject);
@@ -2496,7 +2497,7 @@ class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
2496
2497
' Returns the TObject.ClassName' , nil );
2497
2498
AddGetSet(' __bound__' , @TPyDelphiObject.Get_Bound, nil ,
2498
2499
' 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 ,
2500
2501
' Returns True if the wrapper owns the Delphi instance.' , nil );
2501
2502
end ;
2502
2503
end ;
@@ -2743,6 +2744,21 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
2743
2744
end ;
2744
2745
end ;
2745
2746
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
+
2746
2762
function TPyDelphiObject.SqAssItem (idx: NativeInt; obj: PPyObject): integer;
2747
2763
begin
2748
2764
if HasContainerAccessClass then
0 commit comments