Author: Armin Rigo <[email protected]>
Branch: sandbox-2
Changeset: r97133:202992141e0c
Date: 2019-08-09 21:37 +0200
http://bitbucket.org/pypy/pypy/changeset/202992141e0c/

Log:    translation fix

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -366,6 +366,8 @@
         from pypy.module.gc.hook import LowLevelGcHooks
         if self.space is None:
             raise Exception("get_gchooks must be called after get_entry_point")
+        if self.space.config.translation.sandbox:
+            return None
         return self.space.fromcache(LowLevelGcHooks)
 
     def get_entry_point(self, config):
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -62,8 +62,8 @@
     #
     if space.config.translation.sandbox:
         if new_limit > space.sys.recursionlimit:
-            raise oefmt(space.w_RuntimeError, "sandbox: cannot increase the "
-                                              "recursion limit")
+            msg = "sandbox: cannot increase the recursion limit" 
+            space.warn(space.newtext(msg), space.w_RuntimeWarning)
         return
     #
     space.sys.recursionlimit = new_limit
diff --git a/rpython/memory/gc/incminimark.py b/rpython/memory/gc/incminimark.py
--- a/rpython/memory/gc/incminimark.py
+++ b/rpython/memory/gc/incminimark.py
@@ -3119,6 +3119,8 @@
     def rawrefcount_init(self, dealloc_trigger_callback):
         # see pypy/doc/discussion/rawrefcount.rst
         if self.safer_variant():
+            # note that the rawrefcount_xxx() functions should not be callable
+            # if sandbox is enabled; see gctransform/framework.py
             out_of_memory("sandbox: rawrefcount_init() not supported")
             return
         if not self.rrc_enabled:
diff --git a/rpython/memory/gctransform/framework.py 
b/rpython/memory/gctransform/framework.py
--- a/rpython/memory/gctransform/framework.py
+++ b/rpython/memory/gctransform/framework.py
@@ -479,7 +479,8 @@
                                             annmodel.SomeInteger(nonneg=True)],
                                            annmodel.s_None)
 
-        if hasattr(GCClass, 'rawrefcount_init'):
+        if (hasattr(GCClass, 'rawrefcount_init')
+                and not self.translator.config.translation.sandbox):
             self.rawrefcount_init_ptr = getfn(
                 GCClass.rawrefcount_init,
                 [s_gc, SomePtr(GCClass.RAWREFCOUNT_DEALLOC_TRIGGER)],
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to