[pypy-commit] pypy default: add a test for the greenlet sys.exc_info save/restore behaviour which is wrong on cpythons greenlet

RonnyPfannschmidt noreply at buildbot.pypy.org
Thu Jun 23 18:24:36 CEST 2011


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: 
Changeset: r45086:af74db5394fb
Date: 2011-06-23 18:28 +0200
http://bitbucket.org/pypy/pypy/changeset/af74db5394fb/

Log:	add a test for the greenlet sys.exc_info save/restore behaviour
	which is wrong on cpythons greenlet

diff --git a/pypy/module/_stackless/test/test_greenlet.py b/pypy/module/_stackless/test/test_greenlet.py
--- a/pypy/module/_stackless/test/test_greenlet.py
+++ b/pypy/module/_stackless/test/test_greenlet.py
@@ -72,6 +72,23 @@
         g1 = greenlet(f)
         raises(ValueError, g2.switch)
 
+
+    def test_exc_info_save_restore(self):
+        from _stackless import greenlet
+        import sys
+        def f():
+            try:
+                raise ValueError('fun')
+            except:
+                exc_info = sys.exc_info()
+                greenlet(h).switch()
+                assert exc_info == sys.exc_info()
+
+        def h():
+            assert sys.exc_info() == (None, None, None)
+
+        greenlet(f).switch()
+
     def test_exception(self):
         from _stackless import greenlet
         import sys


More information about the pypy-commit mailing list