diff options
author | Brett Cannon <bcannon@gmail.com> | 2006-02-27 23:39:10 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2006-02-27 23:39:10 (GMT) |
commit | a7446e3438194e8abdfe75c2667b03a219e22a0b (patch) | |
tree | 62978fa7a60c62bbfa21c40c8b7181956d84c95d /Python | |
parent | a7444f47b21ac75cd6e4bb06b615b39cd7876fa2 (diff) | |
download | cpython-a7446e3438194e8abdfe75c2667b03a219e22a0b.zip cpython-a7446e3438194e8abdfe75c2667b03a219e22a0b.tar.gz cpython-a7446e3438194e8abdfe75c2667b03a219e22a0b.tar.bz2 |
Check the return code for PyErr_Warn() when warning about raising string
exceptions. This was triggered when 'warnings' had a filter set to "error"
that caught the string exception deprecation warning.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index e2f38ac..2c2104e 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2997,13 +2997,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 (-1 == PyErr_Warn(PyExc_PendingDeprecationWarning, + "raising a string exception is deprecated")) + goto raise_error; + } else if (PyClass_Check(type)) PyErr_NormalizeException(&type, &value, &tb); |