diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-24 08:14:36 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-24 08:14:36 (GMT) |
commit | bcc0db82dc9cb474d56a4cc63748583232d9524f (patch) | |
tree | 0107d20b29b61fc7dfd9626ee7257242f8cf6302 /Objects/intobject.c | |
parent | ed483ba63b9c03845386976bccff5d95df5b570a (diff) | |
download | cpython-bcc0db82dc9cb474d56a4cc63748583232d9524f.zip cpython-bcc0db82dc9cb474d56a4cc63748583232d9524f.tar.gz cpython-bcc0db82dc9cb474d56a4cc63748583232d9524f.tar.bz2 |
Get rid of remnants of integer division
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r-- | Objects/intobject.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c index 86e2e8c..c734840 100644 --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -580,29 +580,8 @@ int_div(PyIntObject *x, PyIntObject *y) case DIVMOD_OK: return PyInt_FromLong(d); case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_divide((PyObject *)x, - (PyObject *)y); - default: - return NULL; - } -} - -static PyObject * -int_classic_div(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - long d, m; - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - if (Py_DivisionWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, "classic int division") < 0) - return NULL; - switch (i_divmod(xi, yi, &d, &m)) { - case DIVMOD_OK: - return PyInt_FromLong(d); - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_divide((PyObject *)x, - (PyObject *)y); + return PyLong_Type.tp_as_number->nb_floor_divide((PyObject *)x, + (PyObject *)y); default: return NULL; } @@ -1034,7 +1013,6 @@ static PyNumberMethods int_as_number = { (binaryfunc)int_add, /*nb_add*/ (binaryfunc)int_sub, /*nb_subtract*/ (binaryfunc)int_mul, /*nb_multiply*/ - (binaryfunc)int_classic_div, /*nb_divide*/ (binaryfunc)int_mod, /*nb_remainder*/ (binaryfunc)int_divmod, /*nb_divmod*/ (ternaryfunc)int_pow, /*nb_power*/ @@ -1057,7 +1035,6 @@ static PyNumberMethods int_as_number = { 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ - 0, /*nb_inplace_divide*/ 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ |