diff Python/exceptions.c @ 35298:b2fe5f8fcfdd legacy-trunk

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.
author Phillip J. Eby <pje@telecommunity.com>
date Tue, 02 Aug 2005 00:46:46 +0000
parents 6641d0542592
children 7fdc639bc5b4
line wrap: on
line diff
--- a/Python/exceptions.c	Mon Aug 01 21:39:29 2005 +0000
+++ b/Python/exceptions.c	Tue Aug 02 00:46:46 2005 +0000
@@ -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__},