@@ -545,7 +545,6 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
545
545
function SetAttrO ( key, value : PPyObject) : Integer; override;
546
546
// Objects are equal when they refer to the same DelphiObject
547
547
function Compare ( obj: PPyObject) : Integer; override;
548
- function RichCompare ( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
549
548
function Repr : PPyObject; override;
550
549
// automatic iterator support when the wrapper implements IContainerAccessProvider
551
550
function Iter : PPyObject; override;
@@ -590,7 +589,6 @@ TPyDelphiVarParameter = class(TPyObject)
590
589
public
591
590
destructor Destroy; override;
592
591
593
- function Compare ( obj: PPyObject) : Integer; override;
594
592
function RichCompare ( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
595
593
function Repr : PPyObject; override;
596
594
@@ -1803,27 +1801,6 @@ function TPyDelphiObject.Repr: PPyObject;
1803
1801
[DelphiObjectClass.ClassName, NativeInt(Self)]))) );
1804
1802
end ;
1805
1803
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
-
1827
1804
function TPyDelphiObject.SetAttrO (key, value : PPyObject): Integer;
1828
1805
1829
1806
function HandleEvent (PropInfo: PPropInfo) : Integer;
@@ -1991,7 +1968,7 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
1991
1968
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType, tpfHaveRichCompare];
1992
1969
PythonType.GenerateCreateFunction := False;
1993
1970
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];
1995
1972
_ContainerAccessClass := GetContainerAccessClass;
1996
1973
if Assigned(_ContainerAccessClass) then
1997
1974
begin
@@ -2195,29 +2172,6 @@ class procedure TPyDelphiMethodObject.SetupType( PythonType : TPythonType );
2195
2172
2196
2173
{ TPyDelphiVarParameter }
2197
2174
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
-
2221
2175
destructor TPyDelphiVarParameter.Destroy;
2222
2176
begin
2223
2177
Value := nil ;
@@ -2284,7 +2238,7 @@ class procedure TPyDelphiVarParameter.SetupType(PythonType: TPythonType);
2284
2238
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
2285
2239
PythonType.GenerateCreateFunction := False;
2286
2240
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 ];
2288
2242
end ;
2289
2243
2290
2244
procedure TPyDelphiVarParameter.SetValue (const Value : PPyObject);
0 commit comments