[Python-checkins] r42629 - in python/branches/release24-maint: Misc/NEWS Python/ceval.c

brett.cannon python-checkins at python.org
Tue Feb 28 00:15:56 CET 2006


Author: brett.cannon
Date: Tue Feb 28 00:15:56 2006
New Revision: 42629

Modified:
   python/branches/release24-maint/Misc/NEWS
   python/branches/release24-maint/Python/ceval.c
Log:
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.


Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Tue Feb 28 00:15:56 2006
@@ -12,6 +12,10 @@
 Core and builtins
 -----------------
 
+- Fix missing check on whether the PendingDeprecationWarning for string
+  exceptions was re-raised as an actual PendingDeprecationWarning when
+  'warnings' is set to a filter action of "error"
+
 - Bug #1378022, UTF-8 files with a leading BOM crashed the interpreter.
 
 - Patch #1400181, fix unicode string formatting to not use the locale.

Modified: python/branches/release24-maint/Python/ceval.c
==============================================================================
--- python/branches/release24-maint/Python/ceval.c	(original)
+++ python/branches/release24-maint/Python/ceval.c	Tue Feb 28 00:15:56 2006
@@ -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);


More information about the Python-checkins mailing list