[pypy-commit] pypy default: Remove unnecessary comment and give up on *args in wrapper

fijal noreply at buildbot.pypy.org
Sun May 12 14:05:45 CEST 2013


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r64003:9fe84dae72e9
Date: 2013-05-12 14:04 +0200
http://bitbucket.org/pypy/pypy/changeset/9fe84dae72e9/

Log:	Remove unnecessary comment and give up on *args in wrapper

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -552,8 +552,6 @@
     def wrapper(*args):
         from pypy.module.cpyext.pyobject import make_ref, from_ref
         from pypy.module.cpyext.pyobject import Reference
-        # we hope that malloc removal removes the newtuple() that is
-        # inserted exactly here by the varargs specializer
         retval = fatal_value
         boxed_args = ()
         try:
diff --git a/rpython/rlib/entrypoint.py b/rpython/rlib/entrypoint.py
--- a/rpython/rlib/entrypoint.py
+++ b/rpython/rlib/entrypoint.py
@@ -1,5 +1,6 @@
 secondary_entrypoints = {}
 
+import py
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rtyper.lltypesystem.lloperation import llop
 from rpython.rlib.objectmodel import we_are_translated
@@ -15,14 +16,15 @@
     from rpython.translator.tool.cbuild import ExternalCompilationInfo
 
     def deco(func):
-        def wrapper(*args):
+        source = py.code.Source("""
+        def wrapper(%(args)s):
             # the tuple has to be killed, but it's fine because this is
             # called from C
             rffi.stackcounter.stacks_counter += 1
             llop.gc_stack_bottom(lltype.Void)   # marker for trackgcroot.py
             # this should not raise
             try:
-                res = func(*args)
+                res = func(%(args)s)
             except Exception, e:
                 if not we_are_translated():
                     import traceback
@@ -34,7 +36,12 @@
                     assert 0 # dead code
             rffi.stackcounter.stacks_counter -= 1
             return res
-
+        """ % {'args': ', '.join(['arg%d' % i for i in range(len(argtypes))])})
+        d = {'rffi': rffi, 'lltype': lltype,
+         'pypy_debug_catch_fatal_exception': pypy_debug_catch_fatal_exception,
+         'llop': llop, 'func': func, 'we_are_translated': we_are_translated}
+        exec source.compile() in d
+        wrapper = d['wrapper']
         secondary_entrypoints.setdefault(key, []).append((wrapper, argtypes))
         wrapper.func_name = func.func_name
         if c_name is not None:


More information about the pypy-commit mailing list