Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef0068f commit 9fb0368Copy full SHA for 9fb0368
1 file changed
Objects/object.c
@@ -117,11 +117,26 @@ cmpobject(v, w)
117
return -1;
118
if (w == NULL)
119
return 1;
120
- if ((tp = v->ob_type) != w->ob_type)
+ if ((tp = v->ob_type) != w->ob_type) {
121
+ if (tp->tp_as_number != NULL &&
122
+ w->ob_type->tp_as_number != NULL) {
123
+ if (coerce(&v, &w) != 0) {
124
+ err_clear();
125
+ /* XXX Should report the error,
126
+ XXX but the interface isn't there... */
127
+ }
128
+ else {
129
+ int cmp = (*v->ob_type->tp_compare)(v, w);
130
+ DECREF(v);
131
+ DECREF(w);
132
+ return cmp;
133
134
135
return strcmp(tp->tp_name, w->ob_type->tp_name);
136
137
if (tp->tp_compare == NULL)
138
return (v < w) ? -1 : 1;
- return ((*tp->tp_compare)(v, w));
139
+ return (*tp->tp_compare)(v, w);
140
}
141
142
object *
0 commit comments