Author: Ronan Lamy <[email protected]>
Branch: llimpl
Changeset: r82107:ad357db1fd3f
Date: 2016-02-07 02:01 +0000
http://bitbucket.org/pypy/pypy/changeset/ad357db1fd3f/

Log:    Extract some code out of ExtFuncEntry

diff --git a/rpython/rtyper/extfunc.py b/rpython/rtyper/extfunc.py
--- a/rpython/rtyper/extfunc.py
+++ b/rpython/rtyper/extfunc.py
@@ -44,12 +44,8 @@
         impl = getattr(self, 'lltypeimpl', None)
         fakeimpl = getattr(self, 'lltypefakeimpl', self.instance)
         if impl:
-            if (rtyper.annotator.translator.config.translation.sandbox
-                    and not self.safe_not_sandboxed):
-                from rpython.translator.sandbox.rsandbox import (
-                    make_sandbox_trampoline)
-                impl = make_sandbox_trampoline(
-                    self.name, signature_args, s_result)
+            impl = make_impl(rtyper, impl, self.safe_not_sandboxed, self.name,
+                             signature_args, s_result)
             if isinstance(impl, _ptr):
                 obj = impl
             else:
@@ -70,6 +66,13 @@
         hop.exception_is_here()
         return hop.genop('direct_call', vlist, r_result)
 
+def make_impl(rtyper, impl, sandboxsafe, name, args_s, s_result):
+    if (rtyper.annotator.translator.config.translation.sandbox
+            and not sandboxsafe):
+        from rpython.translator.sandbox.rsandbox import make_sandbox_trampoline
+        impl = make_sandbox_trampoline(name, args_s, s_result)
+    return impl
+
 def register_external(function, args, result=None, export_name=None,
                        llimpl=None, llfakeimpl=None, sandboxsafe=False):
     """
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to