[pypy-svn] r20471 - pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem

pedronis at codespeak.net pedronis at codespeak.net
Thu Dec 1 00:14:57 CET 2005


Author: pedronis
Date: Thu Dec  1 00:14:56 2005
New Revision: 20471

Modified:
   pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py
Log:
when reading value to fill instances fallback to the classdesc if the getattr on the instance failed



Modified: pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/rpython/lltypesystem/rclass.py	Thu Dec  1 00:14:56 2005
@@ -401,11 +401,14 @@
                 else:
                     try:
                         attrvalue = getattr(value, name)
+                        llattrvalue = r.convert_const(attrvalue)
                     except AttributeError:
-                        warning("prebuilt instance %r has no attribute %r" % (
-                            value, name))
-                        continue
-                    llattrvalue = r.convert_const(attrvalue)
+                        attrvalue = self.classdef.classdesc.read_attribute(name, None)
+                        if attrvalue is None:
+                            warning("prebuilt instance %r has no attribute %r" % (
+                                    value, name))
+                            continue
+                        llattrvalue = r.convert_desc_or_cosnt(attrvalue)
                 setattr(result, mangled_name, llattrvalue)
         else:
             # OBJECT part



More information about the Pypy-commit mailing list