mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
default_3way_compare(): use PyNumber_Check(), rather than testing for
tp_as_number directly.
This commit is contained in:
parent
6921eca227
commit
fb50d3ffa1
1 changed files with 3 additions and 3 deletions
|
|
@ -633,12 +633,12 @@ default_3way_compare(PyObject *v, PyObject *w)
|
|||
if (w == Py_None)
|
||||
return 1;
|
||||
|
||||
/* different type: compare type names */
|
||||
if (v->ob_type->tp_as_number)
|
||||
/* different type: compare type names; numbers are smaller */
|
||||
if (PyNumber_Check(v))
|
||||
vname = "";
|
||||
else
|
||||
vname = v->ob_type->tp_name;
|
||||
if (w->ob_type->tp_as_number)
|
||||
if (PyNumber_Check(w))
|
||||
wname = "";
|
||||
else
|
||||
wname = w->ob_type->tp_name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue