Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r72261:0bbd2a9b36a6
Date: 2014-06-28 10:57 +0200
http://bitbucket.org/pypy/pypy/changeset/0bbd2a9b36a6/

Log:    Oups, fix -- can't use the GC here, at least in some tests

diff --git a/rpython/rtyper/lltypesystem/rffi.py 
b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -193,11 +193,20 @@
         else:
             # ...well, unless it's a macro, in which case we still have
             # to hide it from the JIT...
-            @jit.dont_look_inside
-            def call_external_function(*args):
-                return funcptr(*args)
+            argnames = ', '.join(['a%d' % i for i in range(len(args))])
+            source = py.code.Source("""
+                def call_external_function(%(argnames)s):
+                    return funcptr(%(argnames)s)
+            """ % locals())
+            miniglobals = {'funcptr':     funcptr,
+                           '__name__':    __name__,
+                           }
+            exec source.compile() in miniglobals
+            call_external_function = miniglobals['call_external_function']
             call_external_function = func_with_new_name(call_external_function,
                                                         'ccall_' + name)
+            call_external_function = jit.dont_look_inside(
+                call_external_function)
 
     unrolling_arg_tps = unrolling_iterable(enumerate(args))
     def wrapper(*args):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to