mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Get rid of most of the rest of coerce (slot is still there for now).
This commit is contained in:
parent
79212998a8
commit
4886cc331f
19 changed files with 131 additions and 497 deletions
|
|
@ -681,9 +681,7 @@ try_3way_compare(PyObject *v, PyObject *w)
|
|||
b) have different types or a type without tp_compare; and
|
||||
c) don't have a user-defined tp_compare.
|
||||
tp_compare implementations in C assume that both arguments
|
||||
have their type, so we give up if the coercion fails or if
|
||||
it yields types which are still incompatible (which can
|
||||
happen with a user-defined nb_coerce).
|
||||
have their type, so we give up if the coercion fails.
|
||||
*/
|
||||
c = PyNumber_CoerceEx(&v, &w);
|
||||
if (c < 0)
|
||||
|
|
@ -1513,22 +1511,6 @@ PyNumber_CoerceEx(PyObject **pv, PyObject **pw)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Coerce two numeric types to the "larger" one.
|
||||
Increment the reference count on each argument.
|
||||
Return -1 and raise an exception if no coercion is possible
|
||||
(and then no reference count is incremented).
|
||||
*/
|
||||
int
|
||||
PyNumber_Coerce(PyObject **pv, PyObject **pw)
|
||||
{
|
||||
int err = PyNumber_CoerceEx(pv, pw);
|
||||
if (err <= 0)
|
||||
return err;
|
||||
PyErr_SetString(PyExc_TypeError, "number coercion failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/* Test whether an object can be called */
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue