[pypy-commit] pypy unpickle-coroutine-trampoline: implement the next feature by doing nothing

cfbolz noreply at buildbot.pypy.org
Fri May 13 14:31:55 CEST 2011


Author: Carl Friedrich Bolz <cfbolz at gmx.de>
Branch: unpickle-coroutine-trampoline
Changeset: r44119:0383767278f6
Date: 2011-05-13 14:26 +0200
http://bitbucket.org/pypy/pypy/changeset/0383767278f6/

Log:	implement the next feature 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
@@ -394,8 +394,6 @@
         elif opcode == map['CALL_FUNCTION']:
             if nkwds == 0:     # only positional arguments
                 frame.dropvalues(nargs + 1)
-            else:
-                raise NotImplementedError   # includes keyword arguments
         else:
             assert 0
 
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
@@ -84,6 +84,41 @@
         finally:
             del sys.modules['mod']
 
+    def test_kwargs(self):
+
+        import new, sys
+
+        mod = new.module('mod')
+        sys.modules['mod'] = mod
+        try:
+            exec '''
+output = []
+import _stackless
+def f(coro, n, x, step=4):
+    if n == 0:
+        coro.switch()
+        return
+    f(coro, n-1, 2*x, step=1)
+    output.append(x)
+
+def example():
+    main_coro = _stackless.coroutine.getcurrent()
+    sub_coro = _stackless.coroutine()
+    sub_coro.bind(f, main_coro, 5, 1, 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_closure(self):
         import new, sys
 


More information about the pypy-commit mailing list