Support throw() of string exceptions.

This commit is contained in:
Phillip J. Eby 2006-03-25 00:05:50 +00:00
parent 43b00da219
commit bee0712214
2 changed files with 8 additions and 3 deletions

View file

@ -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",