Author: Armin Rigo <[email protected]>
Branch:
Changeset: r58700:7a5a5922f61e
Date: 2012-11-03 15:45 +0100
http://bitbucket.org/pypy/pypy/changeset/7a5a5922f61e/
Log: Fix non-obvious annotation bug.
diff --git a/pypy/annotation/bookkeeper.py b/pypy/annotation/bookkeeper.py
--- a/pypy/annotation/bookkeeper.py
+++ b/pypy/annotation/bookkeeper.py
@@ -535,6 +535,11 @@
raise Exception("%s: %r" % (msg, pyobj))
result = self.getfrozen(pyobj)
self.descs[pyobj] = result
+ #
+ if (isinstance(result, description.ClassDesc) and
+ not result.specialize):
+ result.getuniqueclassdef() # force it: see rpython/test's
+ # test_rpbc.test_pbc_of_classes_not_all_used
return result
def have_seen(self, x):
diff --git a/pypy/rpython/test/test_rpbc.py b/pypy/rpython/test/test_rpbc.py
--- a/pypy/rpython/test/test_rpbc.py
+++ b/pypy/rpython/test/test_rpbc.py
@@ -1620,6 +1620,26 @@
res = self.interpret(g, [1])
assert not res
+ def test_pbc_of_classes_not_all_used(self):
+ class Base(object): pass
+ class A(Base): pass
+ class B(Base): pass
+ def poke(lst):
+ pass
+ def g():
+ A()
+ poke([A, B])
+ self.interpret(g, [])
+
+ def test_pbc_of_classes_isinstance_only(self):
+ class Base(object): pass
+ class ASub(Base): pass
+ def g():
+ x = Base()
+ return isinstance(x, ASub)
+ res = self.interpret(g, [])
+ assert res == False
+
class TestLLtype(BaseTestRPBC, LLRtypeMixin):
pass
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit