From: Raymond Hettinger Date: Sat, 20 Jul 2013 17:56:58 +0000 (-0700) Subject: Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect... X-Git-Tag: v2.7.6rc1~291 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69468146b4ed8a92d63b22c91db7c1832dd49a78;p=thirdparty%2FPython%2Fcpython.git Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results. --- diff --git a/Misc/NEWS b/Misc/NEWS index 5283da69c173..87a4ec5ca24f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -28,6 +28,9 @@ Library - 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 index 0dc6bdb3968a..57206785e71c 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);