[pypy-svn] r9173 - in pypy/branch/dist-interpapp/pypy: interpreter translator

pedronis at codespeak.net pedronis at codespeak.net
Sat Feb 12 19:08:02 CET 2005


Author: pedronis
Date: Sat Feb 12 19:08:02 2005
New Revision: 9173

Modified:
   pypy/branch/dist-interpapp/pypy/interpreter/gateway.py
   pypy/branch/dist-interpapp/pypy/translator/genc.py
Log:
small fixes for translate_pypy -no-a, ignore py.lib string subclasses



Modified: pypy/branch/dist-interpapp/pypy/interpreter/gateway.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/gateway.py	(original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/gateway.py	Sat Feb 12 19:08:02 2005
@@ -598,6 +598,8 @@
     interp-level function that invokes the callable with the given
     name at app-level."""
 
+    NOT_RPYTHON_ATTRIBUTES = ['code']
+
     def __init__(self, source):
         "NOT_RPYTHON"
         self.code = py.code.Source(source).compile()

Modified: pypy/branch/dist-interpapp/pypy/translator/genc.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/translator/genc.py	(original)
+++ pypy/branch/dist-interpapp/pypy/translator/genc.py	Sat Feb 12 19:08:02 2005
@@ -35,6 +35,11 @@
     return 'PyRun_String("%s", Py_eval_input, PyEval_GetGlobals(), NULL)' % (
         source, )
 
+def builtin_base(obj):
+    typ = type(obj)
+    while typ.__module__ != '__builtin__':
+        typ = typ.__base__
+    return typ
 
 class GenC:
     MODNAMES = {}
@@ -71,8 +76,8 @@
             else:
                 stackentry = obj
             self.debugstack = (self.debugstack, stackentry)
-            if (type(obj).__module__ != '__builtin__' and
-                not isinstance(obj, type)):   # skip user-defined metaclasses
+            obj_builtin_base = builtin_base(obj)
+            if obj_builtin_base in (object, int, long) and type(obj) is not obj_builtin_base:
                 # assume it's a user defined thingy
                 name = self.nameof_instance(obj)
             else:



More information about the Pypy-commit mailing list