[pypy-commit] pypy sandbox-2: Remove support for register_replacement_for(sandboxed_name=...)

arigo pypy.commits at gmail.com
Tue Aug 6 09:42:07 EDT 2019


Author: Armin Rigo <arigo at tunes.org>
Branch: sandbox-2
Changeset: r97072:e1fde97711a7
Date: 2019-08-06 15:41 +0200
http://bitbucket.org/pypy/pypy/changeset/e1fde97711a7/

Log:	Remove support for register_replacement_for(sandboxed_name=...)

diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -311,19 +311,12 @@
 def sc_we_are_translated(ctx):
     return Constant(True)
 
-def register_replacement_for(replaced_function, sandboxed_name=None):
+def register_replacement_for(replaced_function):
     def wrap(func):
         from rpython.rtyper.extregistry import ExtRegistryEntry
-        # to support calling func directly
-        func._sandbox_external_name = sandboxed_name
         class ExtRegistry(ExtRegistryEntry):
             _about_ = replaced_function
             def compute_annotation(self):
-                if sandboxed_name:
-                    config = self.bookkeeper.annotator.translator.config
-                    if config.translation.sandbox:
-                        func._sandbox_external_name = sandboxed_name
-                        func._dont_inline_ = True
                 return self.bookkeeper.immutablevalue(func)
         return func
     return wrap
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -461,9 +461,7 @@
     func = getattr(os, name, None)
     if func is None:
         return lambda f: f
-    return register_replacement_for(
-        func,
-        sandboxed_name='ll_os.ll_os_%s' % name)
+    return register_replacement_for(func)
 
 @specialize.arg(0)
 def handle_posix_error(name, result):
diff --git a/rpython/rlib/rtime.py b/rpython/rlib/rtime.py
--- a/rpython/rlib/rtime.py
+++ b/rpython/rlib/rtime.py
@@ -103,9 +103,7 @@
     func = getattr(pytime, name, None)
     if func is None:
         return lambda f: f
-    return register_replacement_for(
-        func,
-        sandboxed_name='ll_time.ll_time_%s' % name)
+    return register_replacement_for(func)
 
 config = rffi_platform.configure(CConfig)
 globals().update(config)
diff --git a/rpython/rtyper/rtyper.py b/rpython/rtyper/rtyper.py
--- a/rpython/rtyper/rtyper.py
+++ b/rpython/rtyper/rtyper.py
@@ -569,17 +569,6 @@
     def getcallable(self, graph):
         def getconcretetype(v):
             return self.bindingrepr(v).lowleveltype
-        if self.annotator.translator.config.translation.sandbox:
-            try:
-                name = graph.func._sandbox_external_name
-            except AttributeError:
-                pass
-            else:
-                args_s = [v.annotation for v in graph.getargs()]
-                s_result = graph.getreturnvar().annotation
-                sandboxed = make_sandbox_trampoline(name, args_s, s_result)
-                return self.getannmixlevel().delayedfunction(
-                        sandboxed, args_s, s_result)
 
         return getfunctionptr(graph, getconcretetype)
 


More information about the pypy-commit mailing list