[Python-Dev] Mountain Lion drops sign of zero, breaks test_cmath...

R. David Murray rdmurray at bitdance.com
Fri Aug 17 15:24:17 CEST 2012


On 2012年8月17日 04:00:50 -0400, Trent Nelson <trent at snakebite.org> wrote:
> This is the patch I came up with against test_cmath.py:
>> xenon% hg diff Lib/test/test_cmath.py
> diff -r ce49599b9fdf Lib/test/test_cmath.py
> --- a/Lib/test/test_cmath.py Thu Aug 16 22:14:43 2012 +0200
> +++ b/Lib/test/test_cmath.py Fri Aug 17 07:54:05 2012 +0000
> @@ -121,8 +121,10 @@
> # if both a and b are zero, check whether they have the same sign
> # (in theory there are examples where it would be legitimate for a
> # and b to have opposite signs; in practice these hardly ever
> - # occur).
> - if not a and not b:
> + # occur) -- the exception to this is if we're on a system that drops
> + # the sign on zeros.
> + drops_zero_sign = sysconfig.get_config_var('LOG1P_DROPS_ZERO_SIGN')
> + if not drops_zero_sign and not a and not b:
> if math.copysign(1., a) != math.copysign(1., b):
> self.fail(msg or 'zero has wrong sign: expected {!r}, '
> 'got {!r}'.format(a, b))
>> With that applied, all the test_cmath tests pass again (without any
> changes to the test file).
>> Thoughts?

Open an issue on the tracker and make mark.dickinson (and maybe skrah)
nosy.
--David


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /