[pypy-svn] r48860 - in pypy/branch/new-genc-tests-wrapper/pypy/translator: llsupport llvm/test
rxe at codespeak.net
rxe at codespeak.net
Tue Nov 20 19:00:15 CET 2007
Author: rxe
Date: Tue Nov 20 19:00:15 2007
New Revision: 48860
Modified:
pypy/branch/new-genc-tests-wrapper/pypy/translator/llsupport/modwrapper.py
pypy/branch/new-genc-tests-wrapper/pypy/translator/llvm/test/runtest.py
Log:
(cfbolz, rxe) move wrapfn() to modwrapper so genc can use it
Modified: pypy/branch/new-genc-tests-wrapper/pypy/translator/llsupport/modwrapper.py
==============================================================================
--- pypy/branch/new-genc-tests-wrapper/pypy/translator/llsupport/modwrapper.py (original)
+++ pypy/branch/new-genc-tests-wrapper/pypy/translator/llsupport/modwrapper.py Tue Nov 20 19:00:15 2007
@@ -284,4 +284,25 @@
return 'ctypes.c_void_p'
else:
return self.TO_CTYPES[T]
-
+
+def wrapfn(fn):
+ def wrapped(*args):
+ callargs = []
+ for a in args:
+ if hasattr(a, 'chars'):
+ callargs.append(''.join(a.chars))
+ else:
+ callargs.append(a)
+ res = fn(*callargs)
+ if isinstance(res, dict):
+ # these mappings are a simple protocol to work over isolate
+ mapping = {
+ "exceptiontypename": ExceptionWrapper,
+ "tuple": StructTuple,
+ "r_uint": r_uint,
+ "r_longlong": r_longlong,
+ "r_ulonglong": r_ulonglong,
+ }
+ res = mapping[res["type"]](res["value"])
+ return res
+ return wrapped
Modified: pypy/branch/new-genc-tests-wrapper/pypy/translator/llvm/test/runtest.py
==============================================================================
--- pypy/branch/new-genc-tests-wrapper/pypy/translator/llvm/test/runtest.py (original)
+++ pypy/branch/new-genc-tests-wrapper/pypy/translator/llvm/test/runtest.py Tue Nov 20 19:00:15 2007
@@ -6,6 +6,7 @@
from pypy.translator.llvm.genllvm import GenLLVM
from pypy.annotation.model import lltype_to_annotation
from pypy.rpython.lltypesystem.lltype import typeOf
+from pypy.translator.llsupport.modwrapper import wrapfn
optimize_tests = False
native_llvm_backend = True
@@ -92,28 +93,6 @@
return self[i]
else:
raise AttributeError, name
-
-def wrapfn(fn):
- def wrapped(*args):
- callargs = []
- for a in args:
- if hasattr(a, 'chars'):
- callargs.append(''.join(a.chars))
- else:
- callargs.append(a)
- res = fn(*callargs)
- if isinstance(res, dict):
- # these mappings are a simple protocol to work over isolate
- mapping = {
- "exceptiontypename": ExceptionWrapper,
- "tuple": StructTuple,
- "r_uint": r_uint,
- "r_longlong": r_longlong,
- "r_ulonglong": r_ulonglong,
- }
- res = mapping[res["type"]](res["value"])
- return res
- return wrapped
def genllvm_compile(function,
annotation,
More information about the Pypy-commit
mailing list