[pypy-commit] pypy default: Fix the multiple calls to build_types() by passing complete_now=False

arigo noreply at buildbot.pypy.org
Wed Dec 7 17:40:08 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r50264:30e84d345b46
Date: 2011-12-07 15:36 +0100
http://bitbucket.org/pypy/pypy/changeset/30e84d345b46/

Log:	Fix the multiple calls to build_types() by passing
	complete_now=False

diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -131,6 +131,10 @@
             expected_length = 3
         return [W_Root()] * expected_length
 
+    def allocate_instance(self, cls, w_subtype):
+        "NOT_RPYTHON"
+        xxx
+
     # ----------
 
     def translates(self, func=None, argtypes=None):
@@ -138,19 +142,28 @@
             if argtypes is None:
                 nb_args = func.func_code.co_argcount
                 argtypes = [W_Root] * nb_args
+        else:
+            func = lambda: None
+            argtypes = []
         #
         t = TranslationContext()
         self.t = t     # for debugging
         ann = t.buildannotator()
-        if func is not None:
-            ann.build_types(func, argtypes)
-        # annotate all _seen_extras, knowing that annotating some may
-        # grow the list
-        i = 0
-        while i < len(self._seen_extras):
-            print self._seen_extras
-            ann.build_types(self._seen_extras[i], [])
-            i += 1
+        #
+        done = 0
+        while True:
+            # annotate all _seen_extras, knowing that annotating some may
+            # grow the list
+            while done < len(self._seen_extras):
+                print self._seen_extras
+                ann.build_types(self._seen_extras[done], [],
+                                complete_now=False)
+                done += 1
+            # when the list stops growing, really complete
+            ann.build_types(func, argtypes, complete_now=True)
+            # if the list did not grow because of completion, we are done
+            if done == len(self._seen_extras):
+                break
         #t.viewcg()
         t.buildrtyper().specialize()
         t.checkgraphs()


More information about the pypy-commit mailing list