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

arigo at codespeak.net arigo at codespeak.net
Wed Dec 6 01:08:07 CET 2006


Author: arigo
Date: Wed Dec  6 01:08:00 2006
New Revision: 35350

Modified:
   pypy/dist/pypy/rpython/robject.py
Log:
(pedronis, arigo)

Fix buggy fix.  See translator/test/test_extension.


Modified: pypy/dist/pypy/rpython/robject.py
==============================================================================
--- pypy/dist/pypy/rpython/robject.py	(original)
+++ pypy/dist/pypy/rpython/robject.py	Wed Dec  6 01:08:00 2006
@@ -9,19 +9,25 @@
 
 class __extend__(annmodel.SomeObject):
     def rtyper_makerepr(self, rtyper):
-        if self.knowntype is type:
+        kind = getkind(self)
+        if kind == "type":
             return rclass.get_type_repr(rtyper)
-        elif self.is_constant():
+        elif kind == "const":
             return constpyobj_repr
         else:
             return pyobj_repr
     def rtyper_makekey(self):
-        if self.is_constant():
-            return self.__class__, "const"
-        if self.knowntype is type:
-            return self.__class__, "type"
-        else:
-            return self.__class__, "pyobj"
+        return self.__class__, getkind(self)
+
+def getkind(s_obj):
+    if s_obj.is_constant():
+        if getattr(s_obj.const, '__module__', None) == '__builtin__':
+            return "const"
+    if s_obj.knowntype is type:
+        return "type"
+    if s_obj.is_constant():
+        return "const"
+    return "pyobj"
 
 
 class PyObjRepr(Repr):


More information about the pypy-svn mailing list