@@ -545,7 +545,6 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
545545 function SetAttrO ( key, value : PPyObject) : Integer; override;
546546 // Objects are equal when they refer to the same DelphiObject
547547 function Compare ( obj: PPyObject) : Integer; override;
548- function RichCompare ( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
549548 function Repr : PPyObject; override;
550549 // automatic iterator support when the wrapper implements IContainerAccessProvider
551550 function Iter : PPyObject; override;
@@ -590,7 +589,6 @@ TPyDelphiVarParameter = class(TPyObject)
590589 public
591590 destructor Destroy; override;
592591
593- function Compare ( obj: PPyObject) : Integer; override;
594592 function RichCompare ( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
595593 function Repr : PPyObject; override;
596594
@@ -1803,27 +1801,6 @@ function TPyDelphiObject.Repr: PPyObject;
18031801 [DelphiObjectClass.ClassName, NativeInt(Self)]))) );
18041802end ;
18051803
1806- function TPyDelphiObject.RichCompare (obj: PPyObject;
1807- Op: TRichComparisonOpcode): PPyObject;
1808- Var
1809- Res : Boolean;
1810- begin
1811- Res := False;
1812- case Op of
1813- pyLT: Res := Compare(obj) < 0 ;
1814- pyLE: Res := Compare(obj) <= 0 ;
1815- pyEQ: Res := Compare(obj) = 0 ;
1816- pyNE: Res := Compare(obj) <> 0 ;
1817- pyGT: Res := Compare(obj) > 0 ;
1818- pyGE: Res := Compare(obj) >= 0 ;
1819- end ;
1820- if Res then
1821- Result := PPyObject(GetPythonEngine.Py_True)
1822- else
1823- Result := PPyObject(GetPythonEngine.Py_False);
1824- GetPythonEngine.Py_INCREF( Result );
1825- end ;
1826-
18271804function TPyDelphiObject.SetAttrO (key, value : PPyObject): Integer;
18281805
18291806 function HandleEvent (PropInfo: PPropInfo) : Integer;
@@ -1991,7 +1968,7 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
19911968 PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType, tpfHaveRichCompare];
19921969 PythonType.GenerateCreateFunction := False;
19931970 PythonType.DocString.Text := ' Wrapper for Delphi ' + DelphiObjectClass.ClassName;
1994- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare, bsRichCompare];
1971+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
19951972 _ContainerAccessClass := GetContainerAccessClass;
19961973 if Assigned(_ContainerAccessClass) then
19971974 begin
@@ -2195,29 +2172,6 @@ class procedure TPyDelphiMethodObject.SetupType( PythonType : TPythonType );
21952172
21962173{ TPyDelphiVarParameter }
21972174
2198- function TPyDelphiVarParameter.Compare (obj: PPyObject): Integer;
2199- var
2200- _value : PPyObject;
2201- begin
2202- with GetPythonEngine do
2203- begin
2204- if Self.Value = nil then
2205- _value := Py_None
2206- else
2207- _value := Self.Value ;
2208- if IsPython3000 then begin
2209- if PyObject_RichCompareBool(_value, obj, PY_LT) = 1 then
2210- Result := -1
2211- else if PyObject_RichCompareBool(_value, obj, PY_EQ) = 1 then
2212- Result := 0
2213- else
2214- Result := 1 ;
2215- PyErr_Clear;
2216- end else
2217- Result := PyObject_Compare(_value, obj);
2218- end ;
2219- end ;
2220-
22212175destructor TPyDelphiVarParameter.Destroy;
22222176begin
22232177 Value := nil ;
@@ -2284,7 +2238,7 @@ class procedure TPyDelphiVarParameter.SetupType(PythonType: TPythonType);
22842238 PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
22852239 PythonType.GenerateCreateFunction := False;
22862240 PythonType.DocString.Text := ' Container object allowing modification of Delphi var parameters from Python' ;
2287- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare ];
2241+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare ];
22882242end ;
22892243
22902244procedure TPyDelphiVarParameter.SetValue (const Value : PPyObject);
0 commit comments