mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
gh-119057: Use better error messages for zero division (#119066)
This commit is contained in:
parent
153b118b78
commit
1d4c2e4a87
11 changed files with 32 additions and 20 deletions
|
|
@ -523,7 +523,7 @@ complex_div(PyObject *v, PyObject *w)
|
|||
errno = 0;
|
||||
quot = _Py_c_quot(a, b);
|
||||
if (errno == EDOM) {
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero");
|
||||
PyErr_SetString(PyExc_ZeroDivisionError, "division by zero");
|
||||
return NULL;
|
||||
}
|
||||
return PyComplex_FromCComplex(quot);
|
||||
|
|
@ -554,7 +554,7 @@ complex_pow(PyObject *v, PyObject *w, PyObject *z)
|
|||
_Py_ADJUST_ERANGE2(p.real, p.imag);
|
||||
if (errno == EDOM) {
|
||||
PyErr_SetString(PyExc_ZeroDivisionError,
|
||||
"0.0 to a negative or complex power");
|
||||
"zero to a negative or complex power");
|
||||
return NULL;
|
||||
}
|
||||
else if (errno == ERANGE) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue