Author: Armin Rigo <[email protected]>
Branch: sandbox-2
Changeset: r97266:7c1bcd64f114
Date: 2019-08-26 16:59 +0200
http://bitbucket.org/pypy/pypy/changeset/7c1bcd64f114/

Log:    Tweaks

diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -866,9 +866,11 @@
         w_array._charbuf_stop()
         return char
 
+    @sandbox_review(reviewed=True)
     def setitem(self, index, char):
         w_array = self.w_array
         data = w_array._charbuf_start()
+        assert 0 <= index < w_array.len
         data[index] = char
         w_array._charbuf_stop()
 
diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -4,7 +4,7 @@
 
 from rpython.rlib.objectmodel import (
     compute_hash, compute_unique_id, import_from_mixin, always_inline,
-    enforceargs, newlist_hint, specialize, we_are_translated)
+    enforceargs, newlist_hint, specialize, we_are_translated, sandbox_review)
 from rpython.rlib.buffer import StringBuffer
 from rpython.rlib.mutbuffer import MutableStringBuffer
 from rpython.rlib.rarithmetic import ovfcheck
@@ -94,6 +94,7 @@
     def utf8_w(self, space):
         return self._utf8
 
+    @sandbox_review(reviewed=True)
     def readbuf_w(self, space):
         # XXX for now
         from rpython.rlib.rstruct.unichar import pack_codepoint, UNICODE_SIZE
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -1482,6 +1482,7 @@
         calling_conv='win')
 
 
+@sandbox_review(reviewed=True)
 @replace_os_function('utime')
 @specialize.argtype(0, 1)
 def utime(path, times):
@@ -1540,11 +1541,13 @@
             lltype.free(atime, flavor='raw')
             lltype.free(mtime, flavor='raw')
 
+@sandbox_review(check_caller=True)
 def times_to_timeval2p(times, l_timeval2p):
     actime, modtime = times
     _time_to_timeval(actime, l_timeval2p[0])
     _time_to_timeval(modtime, l_timeval2p[1])
 
+@sandbox_review(check_caller=True)
 def _time_to_timeval(t, l_timeval):
     import math
     fracpart, intpart = math.modf(t)
@@ -2255,6 +2258,7 @@
         [rffi.CCHARP, TIMEVAL2P], rffi.INT,
         save_err=rffi.RFFI_SAVE_ERRNO)
 
+    @sandbox_review(reviewed=True)
     @specialize.argtype(1)
     def lutimes(pathname, times):
         if times is None:
@@ -2270,6 +2274,7 @@
         [rffi.INT, TIMEVAL2P], rffi.INT,
         save_err=rffi.RFFI_SAVE_ERRNO)
 
+    @sandbox_review(reviewed=True)
     @specialize.argtype(1)
     def futimes(fd, times):
         if times is None:
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
@@ -1450,6 +1450,7 @@
 # NOTE: This is not a weak key dictionary, thus keeping a lot of stuff alive.
 TEST_RAW_ADDR_KEEP_ALIVE = {}
 
+@sandbox_review(reviewed=True)
 @jit.dont_look_inside
 def get_raw_address_of_string(string):
     """Returns a 'char *' that is valid as long as the rpython string object 
is alive.
diff --git a/rpython/translator/sandbox/graphchecker.py 
b/rpython/translator/sandbox/graphchecker.py
--- a/rpython/translator/sandbox/graphchecker.py
+++ b/rpython/translator/sandbox/graphchecker.py
@@ -21,7 +21,8 @@
     'malloc', 'malloc_varsize', 'free',
     'getfield', 'getarrayitem', 'getinteriorfield', 'raw_load',
     'cast_opaque_ptr', 'cast_ptr_to_int',
-    'gc_thread_run', 'gc_stack_bottom', 'gc_thread_after_fork',
+    'gc_thread_run', 'gc_stack_bottom',
+    'gc_thread_before_fork', 'gc_thread_after_fork',
     'shrink_array', 'gc_pin', 'gc_unpin', 'gc_can_move', 'gc_id',
     'gc_identityhash', 'weakref_create', 'weakref_deref',
     'gc_fq_register', 'gc_fq_next_dead',
@@ -103,8 +104,6 @@
 
             elif opname in ('cast_ptr_to_adr', 'force_cast',
                             'cast_int_to_ptr'):
-                if is_gc_ptr(op.args[0].concretetype):
-                    return "argument is a GC ptr: %r" % (opname,)
                 if is_gc_ptr(op.result.concretetype):
                     return "result is a GC ptr: %r" % (opname,)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to