PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument. Documentation updates are needed, too.
diff --git a/Python/exceptions.c b/Python/exceptions.c
index 2fd74bc..2e7c820 100644
--- a/Python/exceptions.c
+++ b/Python/exceptions.c
@@ -57,6 +57,7 @@
|\n\
+-- SystemExit\n\
+-- StopIteration\n\
+ +-- GeneratorExit\n\
+-- StandardError\n\
| |\n\
| +-- KeyboardInterrupt\n\
@@ -394,6 +395,7 @@
PyDoc_STRVAR(TypeError__doc__, "Inappropriate argument type.");
PyDoc_STRVAR(StopIteration__doc__, "Signal the end from iterator.next().");
+PyDoc_STRVAR(GeneratorExit__doc__, "Request that a generator exit.");
@@ -1583,6 +1585,7 @@
PyObject *PyExc_Exception;
PyObject *PyExc_StopIteration;
+PyObject *PyExc_GeneratorExit;
PyObject *PyExc_StandardError;
PyObject *PyExc_ArithmeticError;
PyObject *PyExc_LookupError;
@@ -1657,6 +1660,8 @@
{"Exception", &PyExc_Exception},
{"StopIteration", &PyExc_StopIteration, &PyExc_Exception,
StopIteration__doc__},
+ {"GeneratorExit", &PyExc_GeneratorExit, &PyExc_Exception,
+ GeneratorExit__doc__},
{"StandardError", &PyExc_StandardError, &PyExc_Exception,
StandardError__doc__},
{"TypeError", &PyExc_TypeError, 0, TypeError__doc__},