diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 17:06:07 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-08-21 17:06:07 (GMT) |
commit | 4886cc331ff158f8ede74878a436adfad205bd2d (patch) | |
tree | e9473cb0fd8449b2bdfcea9826e5c795e6ba87e2 /Objects/floatobject.c | |
parent | 79212998a8d46712edcf7c4f3fbaefca05a7b08b (diff) | |
download | cpython-4886cc331ff158f8ede74878a436adfad205bd2d.zip cpython-4886cc331ff158f8ede74878a436adfad205bd2d.tar.gz cpython-4886cc331ff158f8ede74878a436adfad205bd2d.tar.bz2 |
Get rid of most of the rest of coerce (slot is still there for now).
Diffstat (limited to 'Objects/floatobject.c')
-rw-r--r-- | Objects/floatobject.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/Objects/floatobject.c b/Objects/floatobject.c index cb0d999..40126b2 100644 --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -842,31 +842,6 @@ float_nonzero(PyFloatObject *v) 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 @@ static PyNumberMethods float_as_number = { 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*/ |