[pypy-commit] pypy exctrans: move db.need_sandboxing to the only module using it
rlamy
pypy.commits at gmail.com
Mon Jan 4 11:38:47 EST 2016
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: exctrans
Changeset: r81556:21a54f1585ad
Date: 2016-01-03 17:08 +0100
http://bitbucket.org/pypy/pypy/changeset/21a54f1585ad/
Log: move db.need_sandboxing to the only module using it
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -378,17 +378,6 @@
produce(node)
return result
- def need_sandboxing(self, fnobj):
- if not self.sandbox:
- return False
- if hasattr(fnobj, '_safe_not_sandboxed'):
- return not fnobj._safe_not_sandboxed
- elif getattr(getattr(fnobj, '_callable', None),
- '_sandbox_external_name', None):
- return True
- else:
- return "if_external"
-
def prepare_inline_helpers(self):
all_nodes = self.globalcontainers()
funcnodes = [node for node in all_nodes if node.nodekind == 'func']
diff --git a/rpython/translator/c/node.py b/rpython/translator/c/node.py
--- a/rpython/translator/c/node.py
+++ b/rpython/translator/c/node.py
@@ -822,7 +822,7 @@
getattr(callable, 'c_name', None) is not None):
self.name = forcename or obj._callable.c_name
elif (getattr(obj, 'external', None) == 'C' and
- not db.need_sandboxing(obj)):
+ (not db.sandbox or not need_sandboxing(obj))):
self.name = forcename or self.basename()
else:
self.name = (forcename or
@@ -928,8 +928,17 @@
graph = rsandbox.get_external_function_sandbox_graph(fnobj, db)
return make_funcgen(graph, db)
+def need_sandboxing(fnobj):
+ if hasattr(fnobj, '_safe_not_sandboxed'):
+ return not fnobj._safe_not_sandboxed
+ elif getattr(getattr(fnobj, '_callable', None),
+ '_sandbox_external_name', None):
+ return True
+ else:
+ return "if_external"
+
def select_function_code_generators(fnobj, db, functionname):
- sandbox = db.need_sandboxing(fnobj)
+ sandbox = db.sandbox and need_sandboxing(fnobj)
if hasattr(fnobj, 'graph'):
if sandbox and sandbox != "if_external":
# apply the sandbox transformation
More information about the pypy-commit
mailing list