mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Support throw() of string exceptions.
This commit is contained in:
parent
43b00da219
commit
bee0712214
2 changed files with 8 additions and 3 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue