Patch #1537 from Chad Austin
Change GeneratorExit's base class from Exception to BaseException
(This time I'm applying the patch to the correct sandbox.)
diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt
index a03f7bb..1be5ce0 100644
--- a/Lib/test/exception_hierarchy.txt
+++ b/Lib/test/exception_hierarchy.txt
@@ -1,8 +1,8 @@
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+ +-- GeneratorExit
+-- Exception
- +-- GeneratorExit
+-- StopIteration
+-- StandardError
| +-- ArithmeticError
@@ -33,10 +33,10 @@
| +-- SystemError
| +-- TypeError
| +-- ValueError
- | | +-- UnicodeError
- | | +-- UnicodeDecodeError
- | | +-- UnicodeEncodeError
- | | +-- UnicodeTranslateError
+ | +-- UnicodeError
+ | +-- UnicodeDecodeError
+ | +-- UnicodeEncodeError
+ | +-- UnicodeTranslateError
+-- Warning
+-- DeprecationWarning
+-- PendingDeprecationWarning
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 5d50187..ce3db72 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1658,6 +1658,19 @@
exiting
+GeneratorExit is not caught by except Exception:
+
+>>> def f():
+... try: yield
+... except Exception: print 'except'
+... finally: print 'finally'
+
+>>> g = f()
+>>> g.next()
+>>> del g
+finally
+
+
Now let's try some ill-behaved generators:
>>> def f():