[pypy-commit] pypy py3.6-sandbox-2: fixes
arigo
pypy.commits at gmail.com
Mon Aug 26 12:06:26 EDT 2019
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.6-sandbox-2
Changeset: r97277:fc77f4cd4352
Date: 2019-08-26 18:04 +0200
http://bitbucket.org/pypy/pypy/changeset/fc77f4cd4352/
Log: fixes
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -273,6 +273,9 @@
if level == 'jit':
pass # none at the moment
+ if config.translation.sandbox or config.translation.reverse_debugger:
+ config.objspace.hash = "fnv"
+
def enable_allworkingmodules(config):
modules = working_modules.copy()
diff --git a/pypy/module/_codecs/locale.py b/pypy/module/_codecs/locale.py
--- a/pypy/module/_codecs/locale.py
+++ b/pypy/module/_codecs/locale.py
@@ -5,7 +5,7 @@
import os
import py
import sys
-from rpython.rlib.objectmodel import we_are_translated
+from rpython.rlib.objectmodel import we_are_translated, sandbox_review
from rpython.rlib.rstring import StringBuilder, assert_str0
from rpython.rlib.runicode import (
default_unicode_error_decode, default_unicode_error_encode)
@@ -103,6 +103,7 @@
if self.buf:
lltype.free(self.buf, flavor='raw')
+ at sandbox_review(reviewed=True)
def unicode2rawwcharp(u):
"""unicode -> raw wchar_t*"""
if _should_merge_surrogates():
@@ -115,6 +116,7 @@
return array
unicode2rawwcharp._annenforceargs_ = [unicode]
+ at sandbox_review(check_caller=True)
def _unicode2rawwcharp_loop(u, array):
ulen = len(u)
count = i = 0
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
@@ -439,6 +439,7 @@
s = space.charbuf_w(w_s)
self._frombytes(space, s)
+ @sandbox_review(reviewed=True)
def _frombytes(self, space, s):
if len(s) % self.itemsize != 0:
raise oefmt(space.w_ValueError,
diff --git a/pypy/module/time/interp_time.py b/pypy/module/time/interp_time.py
--- a/pypy/module/time/interp_time.py
+++ b/pypy/module/time/interp_time.py
@@ -475,6 +475,7 @@
from rpython.rlib.rtime import c_select
from rpython.rlib import rwin32
+ at sandbox_review(reviewed=True)
def sleep(space, w_secs):
ns = timestamp_w(space, w_secs)
if not (ns >= 0):
@@ -800,6 +801,7 @@
secs = _timespec_to_seconds(timespec)
return space.newfloat(secs)
+ @sandbox_review(reviewed=True)
@unwrap_spec(clk_id='c_int', secs=float)
def clock_settime(space, clk_id, secs):
with lltype.scoped_alloc(TIMESPEC) as timespec:
@@ -839,6 +841,7 @@
# reset timezone, altzone, daylight and tzname
_init_timezone(space)
+ at sandbox_review(reviewed=True)
@unwrap_spec(format='text')
def strftime(space, format, w_tup=None):
"""strftime(format[, tuple]) -> string
diff --git a/rpython/rlib/rsiphash.py b/rpython/rlib/rsiphash.py
--- a/rpython/rlib/rsiphash.py
+++ b/rpython/rlib/rsiphash.py
@@ -123,8 +123,11 @@
def compute_result_annotation(self):
translator = self.bookkeeper.annotator.translator
- if translator.config.translation.reverse_debugger:
- return # ignore and use the regular hash, with reverse-debugger
+ # you should not call enable_siphash24() when translating with the
+ # reverse-debugger, or with sandbox.
+ assert not translator.config.translation.reverse_debugger
+ assert not translator.config.translation.sandbox
+ #
if hasattr(translator, 'll_hash_string'):
assert translator.ll_hash_string == ll_hash_string_siphash24
else:
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
@@ -1104,6 +1104,7 @@
i += 1
return s.build(), i
+ at sandbox_review(reviewed=True)
def utf82wcharp(utf8, utf8len, track_allocation=True):
from rpython.rlib import rutf8
@@ -1115,6 +1116,7 @@
for ch in rutf8.Utf8StringIterator(utf8):
w[index] = unichr(ch)
index += 1
+ assert index == utf8len
w[index] = unichr(0)
return w
utf82wcharp._annenforceargs_ = [str, int, bool]
More information about the pypy-commit
mailing list