[pypy-svn] r10877 - in pypy/dist/pypy: interpreter translator

pedronis at codespeak.net pedronis at codespeak.net
Tue Apr 19 22:21:11 CEST 2005


Author: pedronis
Date: Tue Apr 19 22:21:11 2005
New Revision: 10877

Modified:
   pypy/dist/pypy/interpreter/typedef.py
   pypy/dist/pypy/translator/ann_override.py
Log:
tweak teh User* classes hierarchy and make instantiate annotation more precise; this avoids
the warnings about user_setup



Modified: pypy/dist/pypy/interpreter/typedef.py
==============================================================================
--- pypy/dist/pypy/interpreter/typedef.py	(original)
+++ pypy/dist/pypy/interpreter/typedef.py	Tue Apr 19 22:21:11 2005
@@ -84,7 +84,12 @@
     body = dict([(key, value)
                  for key, value in User_InsertNameHere.__dict__.items()
                  if not key.startswith('_') or key == '__del__'])
-    subcls = type(name, (cls,), body)
+    if not hasdict and not wants_slots:
+        subcls = type(name, (cls,), body)
+    else:
+        basesubcls = get_unique_interplevel_subclass(cls, False, False)
+        subcls = type(name, (basesubcls,), body)
+
     return subcls
 
 def instantiate(cls):

Modified: pypy/dist/pypy/translator/ann_override.py
==============================================================================
--- pypy/dist/pypy/translator/ann_override.py	(original)
+++ pypy/dist/pypy/translator/ann_override.py	Tue Apr 19 22:21:11 2005
@@ -16,8 +16,14 @@
     bk = getbookkeeper()
     return bk.immutablevalue(None)
 
-def instantiate(cls):
-    clsdef = getbookkeeper().getclassdef(itypedef.W_Root)
+def instantiate(clspbc):
+    assert isinstance(clspbc, annmodel.SomePBC)
+    clsdef = None
+    for cls, v in clspbc.prebuiltinstances.items():
+        if not clsdef:
+            clsdef = getbookkeeper().getclassdef(cls)
+        else:
+            clsdef = clsdef.commonbase(getbookkeeper().getclassdef(cls))
     return annmodel.SomeInstance(clsdef)
 
 def wrap_exception_cls(space, x):



More information about the Pypy-commit mailing list