[Python-3000-checkins] r62612 - python/branches/py3k/Modules/mathmodule.c

mark.dickinson python-3000-checkins at python.org
Thu May 1 02:19:23 CEST 2008


Author: mark.dickinson
Date: Thu May  1 02:19:23 2008
New Revision: 62612

Log:
Whoops.  errno should only be tested when the result is finite.


Modified:
   python/branches/py3k/Modules/mathmodule.c

Modified: python/branches/py3k/Modules/mathmodule.c
==============================================================================
--- python/branches/py3k/Modules/mathmodule.c	(original)
+++ python/branches/py3k/Modules/mathmodule.c	Thu May  1 02:19:23 2008
@@ -188,11 +188,11 @@
 					"math domain error (singularity)");
 			return NULL;
 	}
-	/* on most machines, errno should be 0 at this point */
-	if (errno && is_error(r))
+	if (Py_IS_FINITE(r) && errno && is_error(r))
+		/* this branch unnecessary on most platforms */
 		return NULL;
-	else
-        	return (*from_double_func)(r);
+
+	return (*from_double_func)(r);
 }
 
 /*


More information about the Python-3000-checkins mailing list