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

arigo at codespeak.net arigo at codespeak.net
Mon Jun 12 23:21:56 CEST 2006


Author: arigo
Date: Mon Jun 12 23:21:55 2006
New Revision: 28731

Modified:
   pypy/dist/pypy/objspace/cpy/function.py
   pypy/dist/pypy/rpython/rctypes/tool/compilemodule.py
Log:
Finish the job of r28729.
Don't invoke the debugger in non-interactive uses of compilemodule.


Modified: pypy/dist/pypy/objspace/cpy/function.py
==============================================================================
--- pypy/dist/pypy/objspace/cpy/function.py	(original)
+++ pypy/dist/pypy/objspace/cpy/function.py	Mon Jun 12 23:21:55 2006
@@ -41,15 +41,16 @@
         tramp.passedargs.append(argname)
 
     def visit__object(self, el, orig_sig, tramp):
-        convertermap = {int: '___PyInt_AsLong',
-                        str: '___PyString_AsString',
-                        float: 'XXX'}
+        convertermap = {int: 'int_w',
+                        str: 'str_w',
+                        float: 'float_w'}
         argname = orig_sig.next_arg()
         assert not argname.startswith('w_')
         tramp.inputargs.append(argname)
-        tramp.wrappings.append('%s = %s(%s)' % (argname,
-                                                convertermap[el],
-                                                argname))
+        tramp.wrappings.append('%s = ___space.%s(___W_Object(%s))' %
+                               (argname,
+                                convertermap[el],
+                                argname))
         tramp.passedargs.append(argname)
 
 
@@ -88,8 +89,6 @@
         tramp.miniglobals = {
             '___space':           space,
             '___W_Object':        CPyObjSpace.W_Object,
-            '___PyInt_AsLong':    PyInt_AsLong,
-            '___PyString_AsString':    PyString_AsString, 
             '___bltin':           bltin,
             '___OperationError':  OperationError,
             '___reraise':         reraise,

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 23:21:55 2006
@@ -9,7 +9,7 @@
 import sys
 
 
-def compilemodule(modname):
+def compilemodule(modname, interactive=False):
     "Compile a PyPy module for CPython."
     import pypy.rpython.rctypes.implementation
     from pypy.objspace.cpy.objspace import CPyObjSpace
@@ -63,6 +63,8 @@
     except SystemExit:
         raise
     except:
+        if not interactive:
+            raise
         debug(driver)
         raise SystemExit(1)
     return driver.cbuilder.c_ext_module
@@ -109,7 +111,7 @@
     if len(argv) != 2:
         print >> sys.stderr, __doc__
         sys.exit(2)
-    c_ext_module = compilemodule(argv[1])
+    c_ext_module = compilemodule(argv[1], interactive=True)
     print 'Created %r.' % (c_ext_module.__file__,)
 
 



More information about the Pypy-commit mailing list