[pypy-svn] r16772 - in pypy/release/0.7.x/pypy: annotation translator/test
pedronis at codespeak.net
pedronis at codespeak.net
Sat Aug 27 16:36:10 CEST 2005
Author: pedronis
Date: Sat Aug 27 16:36:08 2005
New Revision: 16772
Modified:
pypy/release/0.7.x/pypy/annotation/bookkeeper.py
pypy/release/0.7.x/pypy/translator/test/test_annrpython.py
Log:
sanity check added: be not pleased with prebuilt instances of classes needing specialization
Modified: pypy/release/0.7.x/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/release/0.7.x/pypy/annotation/bookkeeper.py (original)
+++ pypy/release/0.7.x/pypy/annotation/bookkeeper.py Sat Aug 27 16:36:08 2005
@@ -369,7 +369,9 @@
return self.getpbc(x)
else:
clsdef = self.getclassdef(x.__class__)
-
+ if x.__class__.__dict__.get('_annspecialcase_', '').endswith('ctr_location'):
+ print "encountered a pre-built mutable instance of a class needing specialization: %s" % x.__class__.__name__
+ raise Exception, "encountered a pre-built mutable instance of a class needing specialization: %s" % x.__class__.__name__
if x not in self.seen_mutable: # avoid circular reflowing,
# see for example test_circular_mutable_getattr
self.seen_mutable[x] = True
Modified: pypy/release/0.7.x/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/release/0.7.x/pypy/translator/test/test_annrpython.py (original)
+++ pypy/release/0.7.x/pypy/translator/test/test_annrpython.py Sat Aug 27 16:36:08 2005
@@ -605,6 +605,13 @@
assert s.items[0].knowntype == int
assert s.items[1].knowntype == str
+ def test_class_spec_confused(self):
+ x = snippet.PolyStk()
+ def f():
+ return x
+ a = self.RPythonAnnotator(policy=policy.AnnotatorPolicy())
+ py.test.raises(Exception, a.build_types, f, [])
+
def test_exception_deduction_with_raise1(self):
a = self.RPythonAnnotator()
s = a.build_types(snippet.exception_deduction_with_raise1, [bool])
More information about the Pypy-commit
mailing list