@@ -98,53 +98,6 @@ interpolation_repr(interpolationobject *self)
9898 self -> conversion , self -> format_spec );
9999}
100100
101- static PyObject *
102- interpolation_compare (interpolationobject * self , PyObject * other , int op )
103- {
104- if (op == Py_LT || op == Py_LE || op == Py_GT || op == Py_GE ) {
105- Py_RETURN_NOTIMPLEMENTED ;
106- }
107-
108- if (!PyObject_TypeCheck (other , & _PyInterpolation_Type )) {
109- return (op == Py_EQ ) ? Py_False : Py_True ;
110- }
111-
112- interpolationobject * other_i = (interpolationobject * ) other ;
113-
114- int valueeq = PyObject_RichCompareBool (self -> value , other_i -> value , Py_EQ );
115- if (valueeq == -1 ) {
116- return NULL ;
117- }
118- int expreq = PyUnicode_Compare (self -> expression , other_i -> expression );
119- if (expreq == -1 && PyErr_Occurred ()) {
120- return NULL ;
121- }
122- int conveq = PyObject_RichCompareBool (self -> conversion , other_i -> conversion , Py_EQ ); // conversion might be Py_None
123- if (conveq == -1 ) {
124- return NULL ;
125- }
126- int formatspeceq = PyUnicode_Compare (self -> format_spec , other_i -> format_spec );
127- if (formatspeceq == -1 && PyErr_Occurred ()) {
128- return NULL ;
129- }
130-
131- int eq = valueeq && expreq == 0 && conveq && formatspeceq == 0 ;
132- return PyBool_FromLong (op == Py_EQ ? eq : !eq );
133- }
134-
135- static Py_hash_t
136- interpolation_hash (interpolationobject * self )
137- {
138- PyObject * tuple = PyTuple_Pack (4 , self -> value , self -> expression , self -> conversion , self -> format_spec );
139- if (!tuple ) {
140- return -1 ;
141- }
142-
143- Py_hash_t hash = PyObject_Hash (tuple );
144- Py_DECREF (tuple );
145- return hash ;
146- }
147-
148101static PyMemberDef interpolation_members [] = {
149102 {"value" , Py_T_OBJECT_EX , offsetof(interpolationobject , value ), Py_READONLY , "Value" },
150103 {"expression" , Py_T_OBJECT_EX , offsetof(interpolationobject , expression ), Py_READONLY , "Expression" },
@@ -163,8 +116,6 @@ PyTypeObject _PyInterpolation_Type = {
163116 .tp_new = (newfunc ) interpolation_new ,
164117 .tp_dealloc = (destructor ) interpolation_dealloc ,
165118 .tp_repr = (reprfunc ) interpolation_repr ,
166- .tp_richcompare = (richcmpfunc ) interpolation_compare ,
167- .tp_hash = (hashfunc ) interpolation_hash ,
168119 .tp_members = interpolation_members ,
169120};
170121
0 commit comments