diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-03-25 00:05:50 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-03-25 00:05:50 (GMT) |
commit | bee071221419795d707a15286e08424d141a6ca6 (patch) | |
tree | 1a507dcab84a78155055db907b418bff9932cc05 /Objects | |
parent | 43b00da219d8490631f37cd4424fca30e1848404 (diff) | |
download | cpython-bee071221419795d707a15286e08424d141a6ca6.zip cpython-bee071221419795d707a15286e08424d141a6ca6.tar.gz cpython-bee071221419795d707a15286e08424d141a6ca6.tar.bz2 |
Support throw() of string exceptions.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/genobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/genobject.c b/Objects/genobject.c index 3f6ef85..e7b8f87 100644 --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -249,7 +249,10 @@ gen_throw(PyGenObject *gen, PyObject *args) Py_INCREF(typ); } } - else { + + /* Allow raising builtin string exceptions */ + + else if (!PyString_CheckExact(typ)) { /* Not something you can raise. throw() fails. */ PyErr_Format(PyExc_TypeError, "exceptions must be classes, or instances, not %s", |