[Python-checkins] r78319 - in python/trunk/Objects: complexobject.c floatobject.c

ezio.melotti python-checkins at python.org
Mon Feb 22 17:30:58 CET 2010


Author: ezio.melotti
Date: Mon Feb 22 17:30:58 2010
New Revision: 78319

Log:
#7482: clarify error message in case of division by zero of float and complex numbers.

Modified:
   python/trunk/Objects/complexobject.c
   python/trunk/Objects/floatobject.c

Modified: python/trunk/Objects/complexobject.c
==============================================================================
--- python/trunk/Objects/complexobject.c	(original)
+++ python/trunk/Objects/complexobject.c	Mon Feb 22 17:30:58 2010
@@ -563,7 +563,7 @@
 	quot = c_quot(a, b);
 	PyFPE_END_PROTECT(quot)
 	if (errno == EDOM) {
-		PyErr_SetString(PyExc_ZeroDivisionError, "complex division");
+		PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero");
 		return NULL;
 	}
 	return PyComplex_FromCComplex(quot);
@@ -586,7 +586,7 @@
 	quot = c_quot(a, b);
 	PyFPE_END_PROTECT(quot)
 	if (errno == EDOM) {
-		PyErr_SetString(PyExc_ZeroDivisionError, "complex division");
+		PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero");
 		return NULL;
 	}
 	return PyComplex_FromCComplex(quot);

Modified: python/trunk/Objects/floatobject.c
==============================================================================
--- python/trunk/Objects/floatobject.c	(original)
+++ python/trunk/Objects/floatobject.c	Mon Feb 22 17:30:58 2010
@@ -668,7 +668,7 @@
 #ifdef Py_NAN
 	if (b == 0.0) {
 		PyErr_SetString(PyExc_ZeroDivisionError,
-				"float division");
+				"float division by zero");
 		return NULL;
 	}
 #endif
@@ -690,7 +690,7 @@
 #ifdef Py_NAN
 	if (b == 0.0) {
 		PyErr_SetString(PyExc_ZeroDivisionError,
-				"float division");
+				"float division by zero");
 		return NULL;
 	}
 #endif


More information about the Python-checkins mailing list