summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/cmathmodule.c7
2 files changed, 10 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 9e6c555..f24fc91 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -159,6 +159,9 @@ Core and Builtins
Library
-------
+- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
+ gcc.
+
- Issue #18479: Changed venv Activate.ps1 to make deactivate a function, and
removed Deactivate.ps1.
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index 3021cf0..36bf4a1 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1006,6 +1006,13 @@ cmath_rect(PyObject *self, PyObject *args)
else
errno = 0;
}
+ else if (phi == 0.0) {
+ /* Workaround for buggy results with phi=-0.0 on OS X 10.8. See
+ bugs.python.org/issue18513. */
+ z.real = r;
+ z.imag = r * phi;
+ errno = 0;
+ }
else {
z.real = r * cos(phi);
z.imag = r * sin(phi);