[pypy-svn] r28721 - in pypy/dist/pypy: objspace/cpy rpython/rctypes/tool

arigo at codespeak.net arigo at codespeak.net
Mon Jun 12 18:56:10 CEST 2006


Author: arigo
Date: Mon Jun 12 18:56:09 2006
New Revision: 28721

Modified:
   pypy/dist/pypy/objspace/cpy/objspace.py
   pypy/dist/pypy/objspace/cpy/typedef.py
   pypy/dist/pypy/rpython/rctypes/tool/compilemodule.py
Log:
Make 'compilemodule.py _demo' work again.


Modified: pypy/dist/pypy/objspace/cpy/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/objspace.py	(original)
+++ pypy/dist/pypy/objspace/cpy/objspace.py	Mon Jun 12 18:56:09 2006
@@ -55,7 +55,9 @@
         return w_obj.value
 
     def interpclass_w(self, w_obj):
-        raise NotImplementedError("interpclass_w()")
+        "NOT_RPYTHON."
+        from pypy.objspace.cpy.typedef import cpython2rpython_raw
+        return cpython2rpython_raw(self, w_obj)
 
     def interp_w(self, RequiredClass, w_obj, can_be_None=False):
         """

Modified: pypy/dist/pypy/objspace/cpy/typedef.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/typedef.py	(original)
+++ pypy/dist/pypy/objspace/cpy/typedef.py	Mon Jun 12 18:56:09 2006
@@ -38,6 +38,17 @@
         return w_x
 rpython2cpython.allow_someobjects = True
 
+def cpython2rpython_raw(space, w_obj):
+    "NOT_RPYTHON."
+    try:
+        w_obj, result, follow = space.wrap_cache[id(w_obj)]
+    except KeyError:
+        if isinstance(w_obj.value, rpython_object):
+            result = get_rpython_data(w_obj)
+        else:
+            result = None
+    return result
+
 def cpython2rpython(space, RequiredClass, w_obj):
     if we_are_translated():
         cache = space.fromcache(TypeDefCache)
@@ -48,13 +59,7 @@
             x = w_obj.value
             return cpy_import(RequiredClass, x)
     else:
-        try:
-            w_obj, result, follow = space.wrap_cache[id(w_obj)]
-        except KeyError:
-            if isinstance(w_obj.value, rpython_object):
-                result = get_rpython_data(w_obj)
-            else:
-                result = None
+        result = cpython2rpython_raw(space, w_obj)
         if isinstance(result, RequiredClass):
             return result
     w_objtype = space.type(w_obj)

Modified: pypy/dist/pypy/rpython/rctypes/tool/compilemodule.py
==============================================================================
--- pypy/dist/pypy/rpython/rctypes/tool/compilemodule.py	(original)
+++ pypy/dist/pypy/rpython/rctypes/tool/compilemodule.py	Mon Jun 12 18:56:09 2006
@@ -65,7 +65,8 @@
     if len(argv) != 2:
         print >> sys.stderr, __doc__
         sys.exit(2)
-    compilemodule(argv[1])
+    c_ext_module = compilemodule(argv[1])
+    print 'Created %r.' % (c_ext_module.__file__,)
 
 
 if __name__ == '__main__':



More information about the Pypy-commit mailing list