id summary reporter owner description type status priority milestone component version resolution keywords cc port 31444 MacPorts Python decimal module broken; Python installed from source works correctly josharian@… jyrkiwahlstedt "I noticed very unusual behavior in Python's decimal module, and reported it here: http://stackoverflow.com/questions/7590137/dividing-decimals-yields-invalid-results-in-python-2-5-to-2-7. It was tracked down to the MacPorts Python. I have since found simple reproduction instructions: (1) Install MacPorts Python 2.7 (2.5 and 2.6 also work). Run: python2.7 -m doctest /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/decimal.py Result: 6 doctest failures, including simple things like: Failed example: print Decimal(3).sqrt() Expected: 1.73205080756887729 Got: -8.4467440737095516 (2) Install Python 2.7 from source (code from http://python.org/download/releases/2.7.2/, vanilla configure && make && make install). Run: /usr/local/bin/python2.7 -m doctest /usr/local/lib/python2.7/decimal.py All doctests pass. The decimal.py modules are pure Python, and are identical, so the different must be in the compilation of Python itself. For reference, my MacPorts Python version reports: Python 2.7.2 (default, Sep 13 2011, 13:20:34) [GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.9)] on darwin My from-source Python version: Python 2.7.2 (default, Sep 28 2011, 15:37:49) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin I'm running OS X 10.6.8. Please let me know what other details I can provide to help debug this. " defect closed Normal ports 2.0.3 duplicate python27