summaryrefslogtreecommitdiff
path: root/Lib/test/test_generators.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-12-03 19:47:54 +0000
committerChristian Heimes <christian@cheimes.de>2007-12-03 19:47:54 +0000
commit9a9ce62a560f3428e2d7597c982b3576013eac1b (patch)
tree57a79005f2c5071461ca0a82d8a05b4190213eff /Lib/test/test_generators.py
parent63fae2faf6e4679b6e67e08a80b3935815752908 (diff)
downloadcpython-9a9ce62a560f3428e2d7597c982b3576013eac1b.tar.gz
Patch #1537 from Chad Austin
Change GeneratorExit's base class from Exception to BaseException
Diffstat (limited to 'Lib/test/test_generators.py')
-rw-r--r--Lib/test/test_generators.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 4710c8c00f..0d6908db7e 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -1668,6 +1668,19 @@ And finalization:
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():