Author: Antonio Cuni <[email protected]>
Branch: continulet-no-frame-loop
Changeset: r93031:82b54bb1e271
Date: 2017-11-15 02:01 +0100
http://bitbucket.org/pypy/pypy/changeset/82b54bb1e271/

Log:    add a passing test to check that we stick the continulet stack at
        the right position of the f_back chain

diff --git a/pypy/module/_continuation/test/test_stacklet.py 
b/pypy/module/_continuation/test/test_stacklet.py
--- a/pypy/module/_continuation/test/test_stacklet.py
+++ b/pypy/module/_continuation/test/test_stacklet.py
@@ -378,6 +378,34 @@
         assert stack(f) == ['bar', 'foo']
         c.switch()
 
+    def test_f_back_proper_chaining(self):
+        import sys
+        from _continuation import continulet
+        stack = self.stack
+        #
+        seen = []
+        def bar(c):
+            seen.append(2)
+            assert stack() == ['bar', 'foo', 'test_f_back_proper_chaining']
+            c.switch()
+            seen.append(5)
+            assert stack() == ['bar', 'foo', 'main',
+                               'test_f_back_proper_chaining']
+        def foo(c):
+            bar(c)
+        def main(c):
+            seen.append(4)
+            assert stack() == ['main', 'test_f_back_proper_chaining']
+            c.switch()
+            seen.append(6)
+
+        c = continulet(foo)
+        seen.append(1)
+        c.switch()
+        seen.append(3)
+        f = main(c)
+        assert seen == [1, 2, 3, 4, 5, 6]
+
     def test_f_back(self):
         import sys
         from _continuation import continulet
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to