[pypy-commit] pypy default: Wrong logic. Must only call ann.complete() once at the end.

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


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r50271:ea6c0a78b1e6
Date: 2011-12-07 17:39 +0100
http://bitbucket.org/pypy/pypy/changeset/ea6c0a78b1e6/

Log:	Wrong logic. Must only call ann.complete() once at the end.

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
@@ -232,28 +232,22 @@
             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, complete_now=False)
         #
+        # annotate all _seen_extras, knowing that annotating some may
+        # grow the list
         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
+        while done < len(self._seen_extras):
+            print self._seen_extras
+            ann.build_types(self._seen_extras[done], [],
+                            complete_now=False)
+            done += 1
+        ann.complete()
         #t.viewcg()
         t.buildrtyper().specialize()
         t.checkgraphs()
diff --git a/pypy/objspace/fake/test/test_zmodules.py b/pypy/objspace/fake/test/test_zmodules.py
--- a/pypy/objspace/fake/test/test_zmodules.py
+++ b/pypy/objspace/fake/test/test_zmodules.py
@@ -7,6 +7,9 @@
 def test__random():
     checkmodule('_random')
 
+def test_cStringIO():
+    checkmodule('cStringIO')
+
 def test_itertools():
     checkmodule('itertools')
 


More information about the pypy-commit mailing list