[pypy-svn] r79841 - pypy/trunk/pypy/module/_stackless

arigo at codespeak.net arigo at codespeak.net
Mon Dec 6 11:30:24 CET 2010


Author: arigo
Date: Mon Dec  6 11:30:22 2010
New Revision: 79841

Modified:
   pypy/trunk/pypy/module/_stackless/interp_coroutine.py
Log:
Fix for stackless translations.


Modified: pypy/trunk/pypy/module/_stackless/interp_coroutine.py
==============================================================================
--- pypy/trunk/pypy/module/_stackless/interp_coroutine.py	(original)
+++ pypy/trunk/pypy/module/_stackless/interp_coroutine.py	Mon Dec  6 11:30:22 2010
@@ -304,14 +304,19 @@
 
 def w_descr__framestack(space, self):
     assert isinstance(self, AppCoroutine)
+    counter = 0
     f = self.subctx.topframe
-    items = []
-    if not f:
-        return space.newtuple([])
     while f is not None:
-        items.append(space.wrap(f))
+        counter += 1
         f = f.f_backref()
-    items.reverse()
+    items = [None] * counter
+    f = self.subctx.topframe
+    while f is not None:
+        counter -= 1
+        assert counter >= 0
+        items[counter] = space.wrap(f)
+        f = f.f_backref()
+    assert counter == 0
     return space.newtuple(items)
 
 def makeStaticMethod(module, classname, funcname):



More information about the Pypy-commit mailing list