diff Python/ceval.c @ 36699:aa040410fb9a 2.4

Return value off PyErr_Warn() for raising string exceptions was not being checked. Problem when 'warnings' was set to "error" and thus would re-raise a new exception.
author Brett Cannon <bcannon@gmail.com>
date Mon, 27 Feb 2006 23:15:56 +0000
parents dc6dec156869
children accfb156f9cc
line wrap: on
line diff
--- a/Python/ceval.c	Mon Feb 27 17:49:41 2006 +0000
+++ b/Python/ceval.c	Mon Feb 27 23:15:56 2006 +0000
@@ -2955,12 +2955,14 @@
 		Py_DECREF(tmp);
 	}
 
-	if (PyString_CheckExact(type))
+	if (PyString_CheckExact(type)) {
 		/* Raising builtin string is deprecated but still allowed --
 		 * do nothing.  Raising an instance of a new-style str
 		 * subclass is right out. */
-		PyErr_Warn(PyExc_PendingDeprecationWarning,
-			   "raising a string exception is deprecated");
+		if (PyErr_Warn(PyExc_PendingDeprecationWarning,
+			   "raising a string exception is deprecated"))
+			goto raise_error;
+	}
 
 	else if (PyClass_Check(type))
 		PyErr_NormalizeException(&type, &value, &tb);