mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Generators had their throw() method allowing string exceptions. That's a
no-no. Fixes issue #1147. Need to fix 2.5 to raise a proper warning if a string exception is passed in.
This commit is contained in:
parent
0b7120258a
commit
4c20bc40d7
3 changed files with 5 additions and 5 deletions
|
@ -252,10 +252,7 @@ gen_throw(PyGenObject *gen, PyObject *args)
|
|||
Py_INCREF(typ);
|
||||
}
|
||||
}
|
||||
|
||||
/* Allow raising builtin string exceptions */
|
||||
|
||||
else if (!PyString_CheckExact(typ)) {
|
||||
else {
|
||||
/* 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