Python requires -fwrapv for Decimal division

According to:

http://stackoverflow.com/questions/7590137/dividing-decimals-yields-invalid-results-in-python-2-5-to-2-7

the Python interpreter must be built with -fwrapv for proper Decimal division.

To test:

python -c "from decimal import Decimal; print Decimal(4) / Decimal(2)"

If built with -fwrapv, this yields 2.

Closes Homebrew/homebrew#10487.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
master
Clay McClure 2012-02-25 22:48:59 -05:00 committed by Adam Vandenberg
parent b9e1f00952
commit d4fd1b9aae
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ class Python < Formula
skip_clean ['bin', 'lib']
def install
# Python requires -fwrapv for proper Decimal division
# See: http://stackoverflow.com/questions/7590137/dividing-decimals-yields-invalid-results-in-python-2-5-to-2-7
ENV.append_to_cflags "-fwrapv"
if build_framework? and ARGV.include? "--static"
onoe "Cannot specify both framework and static."
exit 99