#7482: clarify error message in case of division by zero of float and complex numbers.

This commit is contained in:
Ezio Melotti 2010-02-22 16:30:58 +00:00
parent 38c123651c
commit bce3e17bd2
2 changed files with 4 additions and 4 deletions

View File

@ -563,7 +563,7 @@ complex_div(PyObject *v, PyObject *w)
quot = c_quot(a, b); quot = c_quot(a, b);
PyFPE_END_PROTECT(quot) PyFPE_END_PROTECT(quot)
if (errno == EDOM) { if (errno == EDOM) {
PyErr_SetString(PyExc_ZeroDivisionError, "complex division"); PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero");
return NULL; return NULL;
} }
return PyComplex_FromCComplex(quot); return PyComplex_FromCComplex(quot);
@ -586,7 +586,7 @@ complex_classic_div(PyObject *v, PyObject *w)
quot = c_quot(a, b); quot = c_quot(a, b);
PyFPE_END_PROTECT(quot) PyFPE_END_PROTECT(quot)
if (errno == EDOM) { if (errno == EDOM) {
PyErr_SetString(PyExc_ZeroDivisionError, "complex division"); PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero");
return NULL; return NULL;
} }
return PyComplex_FromCComplex(quot); return PyComplex_FromCComplex(quot);

View File

@ -668,7 +668,7 @@ float_div(PyObject *v, PyObject *w)
#ifdef Py_NAN #ifdef Py_NAN
if (b == 0.0) { if (b == 0.0) {
PyErr_SetString(PyExc_ZeroDivisionError, PyErr_SetString(PyExc_ZeroDivisionError,
"float division"); "float division by zero");
return NULL; return NULL;
} }
#endif #endif
@ -690,7 +690,7 @@ float_classic_div(PyObject *v, PyObject *w)
#ifdef Py_NAN #ifdef Py_NAN
if (b == 0.0) { if (b == 0.0) {
PyErr_SetString(PyExc_ZeroDivisionError, PyErr_SetString(PyExc_ZeroDivisionError,
"float division"); "float division by zero");
return NULL; return NULL;
} }
#endif #endif