Author: Carl Friedrich Bolz <[email protected]>
Branch: unpickle-coroutine-trampoline
Changeset: r44121:ea5c28459596
Date: 2011-05-13 14:46 +0200
http://bitbucket.org/pypy/pypy/changeset/ea5c28459596/

Log:    another fix by doing nothing

diff --git a/pypy/module/_stackless/interp_coroutine.py 
b/pypy/module/_stackless/interp_coroutine.py
--- a/pypy/module/_stackless/interp_coroutine.py
+++ b/pypy/module/_stackless/interp_coroutine.py
@@ -405,6 +405,6 @@
         try:
             w_result = frame.execute_frame(w_result, operr)
         except OperationError, operr:
-            raise NotImplementedError
+            pass
         frame = frame.f_backref()
     return w_result
diff --git a/pypy/module/_stackless/test/test_pickle.py 
b/pypy/module/_stackless/test/test_pickle.py
--- a/pypy/module/_stackless/test/test_pickle.py
+++ b/pypy/module/_stackless/test/test_pickle.py
@@ -191,6 +191,43 @@
         finally:
             del sys.modules['mod']
 
+    def test_exception_after_unpickling(self):
+
+        import new, sys
+
+        mod = new.module('mod')
+        sys.modules['mod'] = mod
+        try:
+            exec '''
+output = []
+import _stackless
+def f(coro, n, x):
+    if n == 0:
+        coro.switch()
+        raise ValueError
+    try:
+        f(coro, n-1, 2*x)
+    finally:
+        output.append(x)
+
+def example():
+    main_coro = _stackless.coroutine.getcurrent()
+    sub_coro = _stackless.coroutine()
+    sub_coro.bind(f, main_coro, 5, 1)
+    sub_coro.switch()
+
+    import pickle
+    pckl = pickle.dumps(sub_coro)
+    new_coro = pickle.loads(pckl)
+
+    new_coro.switch()
+
+example()
+assert output == [16, 8, 4, 2, 1]
+''' in mod.__dict__
+        finally:
+            del sys.modules['mod']
+
     def test_loop(self):
         #skip("happily segfaulting")
         import new, sys
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to