[pypy-svn] r12062 - pypy/dist/pypy/interpreter

arigo at codespeak.net arigo at codespeak.net
Sun May 8 10:46:22 CEST 2005


Author: arigo
Date: Sun May  8 10:46:22 2005
New Revision: 12062

Modified:
   pypy/dist/pypy/interpreter/lazymodule.py
Log:
Accepts interp-level classes in the interpleveldef of lazy modules.
They are turned into the app-level type object corresponding to their
typedef attribute.



Modified: pypy/dist/pypy/interpreter/lazymodule.py
==============================================================================
--- pypy/dist/pypy/interpreter/lazymodule.py	(original)
+++ pypy/dist/pypy/interpreter/lazymodule.py	Sun May  8 10:46:22 2005
@@ -103,6 +103,14 @@
                 #print spec, "->", value
                 if hasattr(value, 'func_code'):  # semi-evil 
                     return space.wrap(gateway.interp2app(value))
+
+                try:
+                    is_type = issubclass(value, W_Root)  # pseudo-evil
+                except TypeError:
+                    is_type = False
+                if is_type:
+                    return space.gettypeobject(value.typedef)
+
                 assert isinstance(value, W_Root), (
                     "interpleveldef %s.%s must return a wrapped object "
                     "(got %r instead)" % (pkgroot, spec, value))



More information about the Pypy-commit mailing list