mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Get rid of more coerce cruft (really check in this time :-)
This commit is contained in:
parent
378b2c9a03
commit
ca810467a4
7 changed files with 2 additions and 57 deletions
|
|
@ -1273,33 +1273,6 @@ PyObject_Not(PyObject *v)
|
|||
return res == 0;
|
||||
}
|
||||
|
||||
/* Coerce two numeric types to the "larger" one.
|
||||
Increment the reference count on each argument.
|
||||
Return value:
|
||||
-1 if an error occurred;
|
||||
0 if the coercion succeeded (and then the reference counts are increased);
|
||||
1 if no coercion is possible (and no error is raised).
|
||||
*/
|
||||
int
|
||||
PyNumber_CoerceEx(PyObject **pv, PyObject **pw)
|
||||
{
|
||||
register PyObject *v = *pv;
|
||||
register PyObject *w = *pw;
|
||||
int res;
|
||||
|
||||
if (v->ob_type->tp_as_number && v->ob_type->tp_as_number->nb_coerce) {
|
||||
res = (*v->ob_type->tp_as_number->nb_coerce)(pv, pw);
|
||||
if (res <= 0)
|
||||
return res;
|
||||
}
|
||||
if (w->ob_type->tp_as_number && w->ob_type->tp_as_number->nb_coerce) {
|
||||
res = (*w->ob_type->tp_as_number->nb_coerce)(pw, pv);
|
||||
if (res <= 0)
|
||||
return res;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Test whether an object can be called */
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue