[pypy-svn] r13387 - pypy/dist/pypy/rpython
arigo at codespeak.net
arigo at codespeak.net
Tue Jun 14 17:00:24 CEST 2005
Author: arigo
Date: Tue Jun 14 17:00:23 2005
New Revision: 13387
Modified:
pypy/dist/pypy/rpython/rclass.py
Log:
rtype_new_instance fixed to allow creation of instances of 'object'.
This is needed because object == Exception in our model.
Modified: pypy/dist/pypy/rpython/rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/rclass.py (original)
+++ pypy/dist/pypy/rpython/rclass.py Tue Jun 14 17:00:23 2005
@@ -408,21 +408,22 @@
ctypeptr = inputconst(TYPEPTR, self.rclass.getvtable())
self.setfield(vptr, '__class__', ctypeptr, llops)
# initialize instance attributes from their defaults from the class
- flds = self.allinstancefields.keys()
- flds.sort()
- mro = list(self.classdef.getmro())
- for fldname in flds:
- if fldname == '__class__':
- continue
- mangled_name, r = self.allinstancefields[fldname]
- if r.lowleveltype == Void:
- continue
- for clsdef in mro:
- if fldname in clsdef.cls.__dict__:
- value = clsdef.cls.__dict__[fldname]
- cvalue = inputconst(r, value)
- self.setfield(vptr, fldname, cvalue, llops)
- break
+ if self.classdef is not None:
+ flds = self.allinstancefields.keys()
+ flds.sort()
+ mro = list(self.classdef.getmro())
+ for fldname in flds:
+ if fldname == '__class__':
+ continue
+ mangled_name, r = self.allinstancefields[fldname]
+ if r.lowleveltype == Void:
+ continue
+ for clsdef in mro:
+ if fldname in clsdef.cls.__dict__:
+ value = clsdef.cls.__dict__[fldname]
+ cvalue = inputconst(r, value)
+ self.setfield(vptr, fldname, cvalue, llops)
+ break
return vptr
def rtype_type(self, hop):
More information about the Pypy-commit
mailing list