mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Get rid of remnants of integer division
This commit is contained in:
parent
ed483ba63b
commit
bcc0db82dc
28 changed files with 47 additions and 212 deletions
|
@ -641,25 +641,6 @@ float_div(PyObject *v, PyObject *w)
|
|||
return PyFloat_FromDouble(a);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
float_classic_div(PyObject *v, PyObject *w)
|
||||
{
|
||||
double a,b;
|
||||
CONVERT_TO_DOUBLE(v, a);
|
||||
CONVERT_TO_DOUBLE(w, b);
|
||||
if (Py_DivisionWarningFlag >= 2 &&
|
||||
PyErr_Warn(PyExc_DeprecationWarning, "classic float division") < 0)
|
||||
return NULL;
|
||||
if (b == 0.0) {
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
|
||||
return NULL;
|
||||
}
|
||||
PyFPE_START_PROTECT("divide", return 0)
|
||||
a = a / b;
|
||||
PyFPE_END_PROTECT(a)
|
||||
return PyFloat_FromDouble(a);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
float_rem(PyObject *v, PyObject *w)
|
||||
{
|
||||
|
@ -1128,7 +1109,6 @@ static PyNumberMethods float_as_number = {
|
|||
(binaryfunc)float_add, /*nb_add*/
|
||||
(binaryfunc)float_sub, /*nb_subtract*/
|
||||
(binaryfunc)float_mul, /*nb_multiply*/
|
||||
(binaryfunc)float_classic_div, /*nb_divide*/
|
||||
(binaryfunc)float_rem, /*nb_remainder*/
|
||||
(binaryfunc)float_divmod, /*nb_divmod*/
|
||||
(ternaryfunc)float_pow, /*nb_power*/
|
||||
|
@ -1151,7 +1131,6 @@ static PyNumberMethods float_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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue