New submission from Mark Dickinson <[EMAIL PROTECTED]>: In issue 4506, Skip reported that test_cmath fails on Solaris 10/x86 for 3.0. If my guesses are correct, it probably fails on all x86 systems that (a) use the x87 coprocessor for floating-point (as opposed to using SSE2, for example), and (b) don't have isinf available.
Problem: Py_IS_INFINITY is applied to a floating-point value sitting in an 80-bit x87 register; that value is not infinity, but after moving it back to memory (and hence rounding from 80-bit extended precision to 64-bit double precision with its smaller exponent range) it becomes infinity. Solution: Add a macro to pymath.h that forces rounding from extended precision to double precision; apply this macro *before* calling Py_IS_INFINITY. See attached patch for an example. Problem: After applying the attached patch to the py3k branch, the cmath module fails to build. On OS X 10.5, I get: running build_ext building 'cmath' extension gcc -bundle -undefined dynamic_lookup build/temp.macosx-10.3-i386- 3.1/Users/dickinsm/python_source/py3k/Modules/cmathmodule.o - L/usr/local/lib -o build/lib.macosx-10.3-i386-3.1/cmath.so *** WARNING: renaming "cmath" since importing it failed: dlopen(build/lib.macosx-10.3-i386-3.1/cmath.so, 2): Symbol not found: _Py_force_to_memory Referenced from: /Users/dickinsm/python_source/py3k/build/lib.macosx- 10.3-i386-3.1/cmath.so Expected in: dynamic lookup Solution: ??? Christian, as the architect of pymath.h, do you have any ideas what I'm doing wrong? Or comments on the patch in general? What do I need to do to make Py_force_to_memory visible to extension modules? ---------- assignee: marketdickinson components: Extension Modules files: force_to_memory.patch keywords: patch messages: 77223 nosy: christian.heimes, marketdickinson, skip.montanaro priority: high severity: normal status: open title: Py_IS_INFINITY defect causes test_cmath failure on x86 type: behavior versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12261/force_to_memory.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4575> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com