mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().
This commit is contained in:
commit
a72f0cdaea
4 changed files with 58 additions and 11 deletions
|
@ -986,9 +986,10 @@ cmath_polar_impl(PyModuleDef *module, Py_complex z)
|
|||
{
|
||||
double r, phi;
|
||||
|
||||
errno = 0;
|
||||
PyFPE_START_PROTECT("polar function", return 0)
|
||||
phi = c_atan2(z); /* should not cause any exception */
|
||||
r = _Py_c_abs(z); /* sets errno to ERANGE on overflow; otherwise 0 */
|
||||
r = _Py_c_abs(z); /* sets errno to ERANGE on overflow */
|
||||
PyFPE_END_PROTECT(r)
|
||||
if (errno != 0)
|
||||
return math_error();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue