Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r65484:32a376d76708
Date: 2013-07-19 20:44 +0200
http://bitbucket.org/pypy/pypy/changeset/32a376d76708/

Log:    Fix the second test.

diff --git a/lib_pypy/greenlet.py b/lib_pypy/greenlet.py
--- a/lib_pypy/greenlet.py
+++ b/lib_pypy/greenlet.py
@@ -57,6 +57,7 @@
 
     def __switch(target, methodname, *baseargs):
         current = getcurrent()
+        convert_greenletexit = True
         #
         while not (target.__main or _continulet.is_pending(target)):
             # inlined __nonzero__ ^^^ in case it's overridden
@@ -75,6 +76,16 @@
             # up the 'parent' explicitly.  Good enough, because a Ctrl-C
             # will show that the program is caught in this loop here.)
             target = target.parent
+            # convert a "raise GreenletExit" into "return GreenletExit"
+            if methodname == 'throw' and convert_greenletexit:
+                try:
+                    raise baseargs[0], baseargs[1]
+                except GreenletExit, e:
+                    methodname = 'switch'
+                    baseargs = (((e,), {}),)
+                except:
+                    pass
+                convert_greenletexit = False
         #
         try:
             unbound_method = getattr(_continulet, methodname)
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to