]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Return value off PyErr_Warn() for raising string exceptions was not being
authorBrett Cannon <bcannon@gmail.com>
Mon, 27 Feb 2006 23:15:56 +0000 (23:15 +0000)
committerBrett Cannon <bcannon@gmail.com>
Mon, 27 Feb 2006 23:15:56 +0000 (23:15 +0000)
checked.  Problem when 'warnings' was set to "error" and thus would re-raise a
new exception.

Misc/NEWS
Python/ceval.c

index 9681782a661c10fa1452f68c0369a61b8cf7d713..d216072e55f93713ebdb3fc936cdfec3ada3968b 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,10 @@ What's New in Python 2.4.3c1?
 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.
index 3779ae2bdbe8568ca190af29394bdbe93b7cbff8..474d89b1cd916e7f7d945796530fa873351b0160 100644 (file)
@@ -2955,12 +2955,14 @@ do_raise(PyObject *type, PyObject *value, PyObject *tb)
                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);