New submission from Mark Dickinson: On OS X 10.4, and probably other versions of OS X too, calls to math.log and math.sqrt that should raise ValueError instead return a NaN:
Python 2.6a0 (trunk:60144, Jan 20 2008, 21:43:56) [GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from math import sqrt, log >>> sqrt(-1) nan >>> log(-1) nan The problem is that OS X doesn't set errno in these cases. Attached is a quick fix for this. Note that there's already a test for this (test_exceptions in test_math.py), but this test is only run in verbose mode. See also issue #871657. ---------- components: Extension Modules files: sqrt_minus_one.patch keywords: patch messages: 61373 nosy: marketdickinson priority: normal severity: normal status: open title: sqrt(-1) doesn't raise ValueError on OS X type: behavior versions: Python 2.5, Python 2.6, Python 3.0 Added file: http://bugs.python.org/file9247/sqrt_minus_one.patch __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1879> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com