Mercurial > cpython-lru_cache-weakref
diff Objects/floatobject.c @ 39603:40bbe669b089
Get rid of most of the rest of coerce (slot is still there for now).
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Mon, 21 Aug 2006 17:06:07 +0000 |
| parents | b0cdcbcc5f45 |
| children | 88133417dfd0 |
line wrap: on
line diff
--- a/Objects/floatobject.c Mon Aug 21 16:27:31 2006 +0000 +++ b/Objects/floatobject.c Mon Aug 21 17:06:07 2006 +0000 @@ -842,31 +842,6 @@ return v->ob_fval != 0.0; } -static int -float_coerce(PyObject **pv, PyObject **pw) -{ - if (PyInt_Check(*pw)) { - long x = PyInt_AsLong(*pw); - *pw = PyFloat_FromDouble((double)x); - Py_INCREF(*pv); - return 0; - } - else if (PyLong_Check(*pw)) { - double x = PyLong_AsDouble(*pw); - if (x == -1.0 && PyErr_Occurred()) - return -1; - *pw = PyFloat_FromDouble(x); - Py_INCREF(*pv); - return 0; - } - else if (PyFloat_Check(*pw)) { - Py_INCREF(*pv); - Py_INCREF(*pw); - return 0; - } - return 1; /* Can't do it */ -} - static PyObject * float_long(PyObject *v) { @@ -1119,7 +1094,7 @@ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ - float_coerce, /*nb_coerce*/ + (coercion)0, /*nb_coerce*/ float_int, /*nb_int*/ float_long, /*nb_long*/ float_float, /*nb_float*/
