diff Modules/mathmodule.c @ 15181:2ed358446f2f legacy-trunk

Repaired a comment and asserted a precondition.
author Tim Peters <tim.peters@gmail.com>
date Thu, 12 Oct 2000 19:42:00 +0000
parents 09c7ac188ce2
children bde1cf5740ec
line wrap: on
line diff
--- a/Modules/mathmodule.c	Thu Oct 12 19:31:13 2000 +0000
+++ b/Modules/mathmodule.c	Thu Oct 12 19:42:00 2000 +0000
@@ -18,7 +18,7 @@
 #endif
 
 /* RED_FLAG 12-Oct-2000 Tim
- * What CHECK does if errno != 0 and x is a NaN is a platform-dependent crap
+ * What CHECK does if errno == 0 and x is a NaN is a platform-dependent crap
  * shoot.  Most (but not all!) platforms will end up setting errno to ERANGE
  * then, but EDOM is probably better.
  */
@@ -38,6 +38,7 @@
 is_error(double x)
 {
 	int result = 1;	/* presumption of guilt */
+	assert(errno);	/* non-zero errno is a precondition for calling */
 	if (errno == EDOM)
 		PyErr_SetString(PyExc_ValueError, "math domain error");
 	else if (errno == ERANGE) {