diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2015-06-23 12:38:13 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2015-06-23 12:38:13 (GMT) |
commit | a72f0cdaea847228aceb5b56fbd28b77ef4809c4 (patch) | |
tree | ae80fc12096a3e2dd5989b74a2916e7c856ede58 /Modules/cmathmodule.c | |
parent | 5376ba9630e45ad177150ae68c9712640330a2fc (diff) | |
parent | 6bc217dd3d43763e62b413e75ddaeb7d30e1b451 (diff) | |
download | cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.zip cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.tar.gz cpython-a72f0cdaea847228aceb5b56fbd28b77ef4809c4.tar.bz2 |
Issue #24489: ensure a previously set C errno doesn't disturb cmath.polar().
Diffstat (limited to 'Modules/cmathmodule.c')
-rw-r--r-- | Modules/cmathmodule.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c index d12e4c5..7f6c2c9 100644 --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -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(); |