[pypy-svn] r51730 - in pypy/branch/unified-rtti/pypy/rpython: lltypesystem memory/gctransform

arigo at codespeak.net arigo at codespeak.net
Thu Feb 21 16:42:33 CET 2008


Author: arigo
Date: Thu Feb 21 16:42:32 2008
New Revision: 51730

Modified:
   pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py
   pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
Log:
Fix.


Modified: pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py	(original)
+++ pypy/branch/unified-rtti/pypy/rpython/lltypesystem/lltype.py	Thu Feb 21 16:42:32 2008
@@ -1827,7 +1827,7 @@
 def getGcTypeForRtti(rttiptr):
     assert typeOf(rttiptr) == Ptr(RuntimeTypeInfo)
     if not hasattr(rttiptr._obj, '_GCTYPE'):
-        raise TypeError("rtti object %r is not attached to any type" % (
+        raise ValueError("rtti object %r is not attached to any type" % (
             rttiptr,))
     return rttiptr._obj._GCTYPE
 

Modified: pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py
==============================================================================
--- pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py	(original)
+++ pypy/branch/unified-rtti/pypy/rpython/memory/gctransform/refcounting.py	Thu Feb 21 16:42:32 2008
@@ -287,7 +287,13 @@
         try:
             return self.gcheaderbuilder.typeinfo_from_rtti(rtti)
         except KeyError:
-            TYPE = lltype.getGcTypeForRtti(rtti)
             typeinfo = self.gcheaderbuilder.new_typeinfo(rtti)
-            typeinfo.dealloc = self.static_deallocation_funcptr_for_type(TYPE)
+            try:
+                TYPE = lltype.getGcTypeForRtti(rtti)
+            except ValueError:
+                pass      # ignore rtti's not attached anywhere, e.g. in the
+                          # vtable of raw-flavored RPython classes
+            else:
+                fn = self.static_deallocation_funcptr_for_type(TYPE)
+                typeinfo.dealloc = fn
             return typeinfo



More information about the Pypy-commit mailing list