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

arigo at codespeak.net arigo at codespeak.net
Tue Jul 12 19:32:09 CEST 2005


Author: arigo
Date: Tue Jul 12 19:32:07 2005
New Revision: 14553

Modified:
   pypy/dist/pypy/rpython/rpbc.py
Log:
Pass strange faking-related objects through rpbc to GenC as plain PyObjects.


Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/rpbc.py	Tue Jul 12 19:32:07 2005
@@ -17,6 +17,7 @@
         # and methods.
         call_families = rtyper.annotator.getpbccallfamilies()
         userclasses = rtyper.annotator.getuserclasses()
+        access_sets = rtyper.annotator.getpbcaccesssets()
         choices = {}
         for x, classdef in self.prebuiltinstances.items():
             cdefflag = isclassdef(classdef)
@@ -62,6 +63,10 @@
                 else:
                     raise TyperError("don't know about callable %r" % (x,))
 
+            elif isinstance(x, builtin_descriptor_type):
+                # strange built-in functions, method objects, etc. from fake.py
+                choice = getPyObjRepr
+
             else:
                 # otherwise, just assume it's a plain frozen object
                 choice = getFrozenPBCRepr
@@ -81,6 +86,14 @@
         lst.sort()
         return tuple(lst)
 
+builtin_descriptor_type = (
+    type(len),                             # type 'builtin_function_or_method'
+    type(list.append),                     # type 'method_descriptor'
+    type(type(None).__repr__),             # type 'wrapper_descriptor'
+    type(type.__dict__['__dict__']),       # type 'getset_descriptor'
+    type(type.__dict__['__basicsize__']),  # type 'member_descriptor'
+    )
+
 # ____________________________________________________________
 
 def getPyObjRepr(rtyper, s_pbc):



More information about the Pypy-commit mailing list