[pypy-svn] r13135 - pypy/dist/pypy/rpython

pedronis at codespeak.net pedronis at codespeak.net
Tue Jun 7 02:16:05 CEST 2005


Author: pedronis
Date: Tue Jun  7 02:16:04 2005
New Revision: 13135

Modified:
   pypy/dist/pypy/rpython/lltype.py
Log:
raise a RuntimeError if trying to cast_parent a structure without a parent.



Modified: pypy/dist/pypy/rpython/lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltype.py	(original)
+++ pypy/dist/pypy/rpython/lltype.py	Tue Jun  7 02:16:04 2005
@@ -335,6 +335,8 @@
         PTRTYPE.TO._flds[PTRTYPE.TO._names[0]] != CURTYPE.TO):
         raise InvalidCast(CURTYPE, PTRTYPE)
     parent = ptr._obj._parentstructure()
+    if parent is None:
+        raise RuntimeError("widening to trash: %r" % ptr)
     PARENTTYPE = ptr._obj._parent_type
     if getattr(parent, PARENTTYPE._names[0]) is not ptr._obj:
         raise InvalidCast(CURTYPE, PTRTYPE)



More information about the Pypy-commit mailing list