[pypy-svn] r43732 - in pypy/dist/pypy/rpython: ootypesystem test

antocuni at codespeak.net antocuni at codespeak.net
Sun May 27 18:00:57 CEST 2007


Author: antocuni
Date: Sun May 27 18:00:57 2007
New Revision: 43732

Modified:
   pypy/dist/pypy/rpython/ootypesystem/rclass.py
   pypy/dist/pypy/rpython/test/test_rtyper.py
Log:
test for a bug that occured when trying to translate pyrolog to cli,
and relative bugfix



Modified: pypy/dist/pypy/rpython/ootypesystem/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rclass.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/rclass.py	Sun May 27 18:00:57 2007
@@ -169,6 +169,7 @@
             self.lowleveltype = ootype.Instance(classdef.name, b, {}, {}, _hints = hints)
         self.prebuiltinstances = {}   # { id(x): (x, _ptr) }
         self.object_type = self.lowleveltype
+        self.gcflavor = gcflavor
 
     def _setup_repr(self):
         if self.classdef is None:

Modified: pypy/dist/pypy/rpython/test/test_rtyper.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rtyper.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rtyper.py	Sun May 27 18:00:57 2007
@@ -147,3 +147,21 @@
     cdef = DummyClsDescDef(A)
     cdef._cpy_exported_type_ = type(Ellipsis)
     assert rmodel.getgcflavor(cdef) == 'cpy'
+
+def test_missing_gvflavor_bug():
+    class MyClass:
+        def set_x(self):
+            self.x = create_tuple()
+    def create_tuple():
+        return MyClass(), 42
+    def fn():
+        obj = MyClass()
+        obj.set_x()
+        create_tuple()
+    t = TranslationContext()
+    t.buildannotator().build_types(fn, [])
+    t.buildrtyper(type_system='ootype').specialize()
+    #t.view()
+    t.checkgraphs()
+    graph = graphof(t, fn)
+    assert graph.getreturnvar().concretetype == Void


More information about the pypy-svn mailing list