[Python-checkins] cpython (2.7): Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong
raymond.hettinger
python-checkins at python.org
Sat Jul 20 19:59:52 CEST 2013
http://hg.python.org/cpython/rev/91374660355a
changeset: 84740:91374660355a
branch: 2.7
parent: 84666:a9f7c2d49149
user: Raymond Hettinger <python at rcn.com>
date: Sat Jul 20 10:56:58 2013 -0700
summary:
Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
files:
Misc/NEWS | 3 +++
Modules/cmathmodule.c | 7 +++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -28,6 +28,9 @@
- Issue #18455: multiprocessing should not retry connect() with same socket.
+- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
+ gcc.
+
- Issue #18101: Tcl.split() now process Unicode strings nested in a tuple as it
do with byte strings.
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -1006,6 +1006,13 @@
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);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list