diff options
Diffstat (limited to 'Objects/genobject.c')
| -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", |
