Commit 13bfa3a9 authored by Brett Cannon's avatar Brett Cannon

Cause passing a string to generator.throw() to raise a deprecation warning.

parent 18726be4
......@@ -12,6 +12,9 @@ What's New in Python 2.5.2c1?
Core and builtins
-----------------
- Issue #1147: Generators were not raising a DeprecationWarning when a string
was passed into throw().
- Patch #1031213: Decode source line in SyntaxErrors back to its original source
encoding.
......
......@@ -262,6 +262,12 @@ gen_throw(PyGenObject *gen, PyObject *args)
typ->ob_type->tp_name);
goto failed_throw;
}
else {
/* String exceptions are deprecated. */
if (PyErr_Warn(PyExc_DeprecationWarning,
"raising string exceptions is deprecated"))
goto failed_throw;
}
PyErr_Restore(typ, val, tb);
return gen_send_ex(gen, Py_None, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment