Author: Armin Rigo <[email protected]>
Branch:
Changeset: r61890:e61ccf099ed1
Date: 2013-03-01 17:29 +0100
http://bitbucket.org/pypy/pypy/changeset/e61ccf099ed1/
Log: Test and fix for checkmodule() failing to follow all possible paths.
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
@@ -286,8 +286,10 @@
#print self._seen_extras
ann.build_types(self._seen_extras[done], [],
complete_now=False)
+ ann.complete_pending_blocks()
done += 1
ann.complete()
+ assert done == len(self._seen_extras)
#t.viewcg()
t.buildrtyper().specialize()
t.checkgraphs()
diff --git a/pypy/objspace/fake/test/test_checkmodule.py
b/pypy/objspace/fake/test/test_checkmodule.py
--- a/pypy/objspace/fake/test/test_checkmodule.py
+++ b/pypy/objspace/fake/test/test_checkmodule.py
@@ -3,6 +3,7 @@
from pypy.interpreter.baseobjspace import Wrappable
from pypy.interpreter.typedef import TypeDef, GetSetProperty
from pypy.interpreter.gateway import interp2app, W_Root, ObjSpace
+from rpython.rlib.objectmodel import specialize
from rpython.rtyper.test.test_llinterp import interpret
def make_checker():
@@ -34,6 +35,22 @@
space.translates()
assert check
+def test_wrap_interp2app_later():
+ see, check = make_checker()
+ #
+ @specialize.memo()
+ def hithere(space):
+ space.wrap(interp2app(foobar2))
+ #
+ def foobar(space):
+ hithere(space)
+ def foobar2(space):
+ see()
+ space = FakeObjSpace()
+ space.wrap(interp2app(foobar))
+ space.translates()
+ assert check
+
def test_wrap_GetSetProperty():
see, check = make_checker()
def foobar(w_obj, space):
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -192,8 +192,7 @@
if not self.annotated[block]:
self.pendingblocks[block] = graph
- def complete(self):
- """Process pending blocks until none is left."""
+ def complete_pending_blocks(self):
while True:
while self.pendingblocks:
block, graph = self.pendingblocks.popitem()
@@ -201,6 +200,10 @@
self.policy.no_more_blocks_to_annotate(self)
if not self.pendingblocks:
break # finished
+
+ def complete(self):
+ """Process pending blocks until none is left."""
+ self.complete_pending_blocks()
# make sure that the return variables of all graphs is annotated
if self.added_blocks is not None:
newgraphs = [self.annotated[block] for block in self.added_blocks]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit