[pypy-svn] r78971 - in pypy/branch/rlist-jit/pypy: interpreter module/__builtin__ module/_sre module/exceptions objspace/std rlib rlib/rsre
arigo at codespeak.net
arigo at codespeak.net
Wed Nov 10 17:23:10 CET 2010
Author: arigo
Date: Wed Nov 10 17:23:07 2010
New Revision: 78971
Modified:
pypy/branch/rlist-jit/pypy/interpreter/argument.py
pypy/branch/rlist-jit/pypy/interpreter/function.py
pypy/branch/rlist-jit/pypy/interpreter/pycode.py
pypy/branch/rlist-jit/pypy/module/__builtin__/interp_classobj.py
pypy/branch/rlist-jit/pypy/module/_sre/interp_sre.py
pypy/branch/rlist-jit/pypy/module/exceptions/interp_exceptions.py
pypy/branch/rlist-jit/pypy/objspace/std/typeobject.py
pypy/branch/rlist-jit/pypy/objspace/std/typetype.py
pypy/branch/rlist-jit/pypy/rlib/debug.py
pypy/branch/rlist-jit/pypy/rlib/rsre/rsre_core.py
Log:
A random set of fixes. Mostly a bit annoying.
Modified: pypy/branch/rlist-jit/pypy/interpreter/argument.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/interpreter/argument.py (original)
+++ pypy/branch/rlist-jit/pypy/interpreter/argument.py Wed Nov 10 17:23:07 2010
@@ -3,7 +3,7 @@
"""
from pypy.interpreter.error import OperationError, operationerrfmt
-from pypy.rlib.debug import make_sure_not_resized, list_not_modified_any_more
+from pypy.rlib.debug import make_sure_not_resized
from pypy.rlib import jit
@@ -134,8 +134,7 @@
def replace_arguments(self, args_w):
"Return a new Arguments with a args_w as positional arguments."
- return Arguments(self.space, list_not_modified_any_more(args_w),
- self.keywords, self.keywords_w)
+ return Arguments(self.space, args_w, self.keywords, self.keywords_w)
def prepend(self, w_firstarg):
"Return a new Arguments with a new argument inserted first."
Modified: pypy/branch/rlist-jit/pypy/interpreter/function.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/interpreter/function.py (original)
+++ pypy/branch/rlist-jit/pypy/interpreter/function.py Wed Nov 10 17:23:07 2010
@@ -198,7 +198,7 @@
else:
name = None
if not space.is_w(w_argdefs, space.w_None):
- defs_w = space.fixedview(w_argdefs)
+ defs_w = space.fixedview(w_argdefs)[:]
else:
defs_w = []
nfreevars = 0
@@ -323,7 +323,7 @@
if space.is_w(w_func_dict, space.w_None):
w_func_dict = None
self.w_func_dict = w_func_dict
- self.defs_w = space.fixedview(w_defs_w)
+ self.defs_w = space.fixedview(w_defs_w)[:]
self.w_module = w_module
def fget_func_defaults(space, self):
@@ -338,7 +338,7 @@
return
if not space.is_true(space.isinstance(w_defaults, space.w_tuple)):
raise OperationError( space.w_TypeError, space.wrap("func_defaults must be set to a tuple object or None") )
- self.defs_w = space.fixedview(w_defaults)
+ self.defs_w = space.fixedview(w_defaults)[:]
def fdel_func_defaults(space, self):
self.defs_w = []
Modified: pypy/branch/rlist-jit/pypy/interpreter/pycode.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/interpreter/pycode.py (original)
+++ pypy/branch/rlist-jit/pypy/interpreter/pycode.py Wed Nov 10 17:23:07 2010
@@ -269,10 +269,10 @@
dis.dis(co)
def fget_co_consts(space, self):
- return space.newtuple(self.co_consts_w[:])
+ return space.newtuple_imm(self.co_consts_w)
def fget_co_names(space, self):
- return space.newtuple(self.co_names_w)
+ return space.newtuple_imm(self.co_names_w)
def fget_co_varnames(space, self):
return space.newtuple([space.wrap(name) for name in self.co_varnames])
@@ -383,8 +383,8 @@
w(self.co_stacksize),
w(self.co_flags),
w(self.co_code),
- space.newtuple(self.co_consts_w[:]),
- space.newtuple(self.co_names_w),
+ space.newtuple_imm(self.co_consts_w),
+ space.newtuple_imm(self.co_names_w),
space.newtuple([w(v) for v in self.co_varnames]),
w(self.co_filename),
w(self.co_name),
Modified: pypy/branch/rlist-jit/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/module/__builtin__/interp_classobj.py (original)
+++ pypy/branch/rlist-jit/pypy/module/__builtin__/interp_classobj.py Wed Nov 10 17:23:07 2010
@@ -40,7 +40,7 @@
# XXX missing: lengthy and obscure logic about "__module__"
- bases_w = space.fixedview(w_bases)
+ bases_w = space.fixedview(w_bases)[:]
for w_base in bases_w:
if not isinstance(w_base, W_ClassObject):
w_metaclass = space.type(w_base)
@@ -92,7 +92,7 @@
raise OperationError(
space.w_TypeError,
space.wrap("__bases__ must be a tuple object"))
- bases_w = space.fixedview(w_bases)
+ bases_w = space.fixedview(w_bases)[:]
for w_base in bases_w:
if not isinstance(w_base, W_ClassObject):
raise OperationError(space.w_TypeError,
Modified: pypy/branch/rlist-jit/pypy/module/_sre/interp_sre.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/module/_sre/interp_sre.py (original)
+++ pypy/branch/rlist-jit/pypy/module/_sre/interp_sre.py Wed Nov 10 17:23:07 2010
@@ -6,6 +6,7 @@
from pypy.interpreter.gateway import interp2app, ObjSpace, W_Root
from pypy.interpreter.error import OperationError
from pypy.rlib.rarithmetic import intmask
+from pypy.rlib.debug import list_not_modified_any_more
from pypy.tool.pairtype import extendabletype
@@ -111,17 +112,18 @@
space = self.space
if pos < 0: pos = 0
if endpos < pos: endpos = pos
+ pattern = list_not_modified_any_more(self.code)
if space.is_true(space.isinstance(w_string, space.w_unicode)):
unicodestr = space.unicode_w(w_string)
if pos > len(unicodestr): pos = len(unicodestr)
if endpos > len(unicodestr): endpos = len(unicodestr)
- return rsre_core.UnicodeMatchContext(self.code, unicodestr,
+ return rsre_core.UnicodeMatchContext(pattern, unicodestr,
pos, endpos, self.flags)
else:
str = space.bufferstr_w(w_string)
if pos > len(str): pos = len(str)
if endpos > len(str): endpos = len(str)
- return rsre_core.StrMatchContext(self.code, str,
+ return rsre_core.StrMatchContext(pattern, str,
pos, endpos, self.flags)
def getmatch(self, ctx, found):
Modified: pypy/branch/rlist-jit/pypy/module/exceptions/interp_exceptions.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/module/exceptions/interp_exceptions.py (original)
+++ pypy/branch/rlist-jit/pypy/module/exceptions/interp_exceptions.py Wed Nov 10 17:23:07 2010
@@ -113,12 +113,12 @@
elif lgt == 1:
return space.str(self.args_w[0])
else:
- return space.str(space.newtuple(self.args_w))
+ return space.str(space.newtuple_imm(self.args_w))
descr_str.unwrap_spec = ['self', ObjSpace]
def descr_repr(self, space):
if self.args_w:
- args_repr = space.str_w(space.repr(space.newtuple(self.args_w)))
+ args_repr = space.str_w(space.repr(space.newtuple_imm(self.args_w)))
else:
args_repr = "()"
clsname = self.getclass(space).getname(space, '?')
@@ -126,13 +126,13 @@
descr_repr.unwrap_spec = ['self', ObjSpace]
def descr_getargs(space, self):
- return space.newtuple(self.args_w)
+ return space.newtuple_imm(self.args_w)
def descr_setargs(space, self, w_newargs):
self.args_w = space.fixedview(w_newargs)
def descr_getitem(self, space, w_index):
- return space.getitem(space.newtuple(self.args_w), w_index)
+ return space.getitem(space.newtuple_imm(self.args_w), w_index)
descr_getitem.unwrap_spec = ['self', ObjSpace, W_Root]
def getdict(self):
@@ -146,7 +146,7 @@
self.w_dict = w_dict
def descr_reduce(self, space):
- lst = [self.getclass(space), space.newtuple(self.args_w)]
+ lst = [self.getclass(space), space.newtuple_imm(self.args_w)]
if self.w_dict is not None and space.is_true(self.w_dict):
lst = lst + [self.w_dict]
return space.newtuple(lst)
@@ -294,7 +294,7 @@
elif len(self.args_w) == 1:
return space.repr(self.args_w[0])
else:
- return space.str(space.newtuple(self.args_w))
+ return space.str(space.newtuple_imm(self.args_w))
key_error_str.unwrap_spec = ['self', ObjSpace]
W_KeyError = _new_exception('KeyError', W_LookupError,
@@ -336,7 +336,7 @@
lst = [self.getclass(space), space.newtuple(
self.args_w + [self.w_filename])]
else:
- lst = [self.getclass(space), space.newtuple(self.args_w)]
+ lst = [self.getclass(space), space.newtuple_imm(self.args_w)]
if self.w_dict is not None and space.is_true(self.w_dict):
lst = lst + [self.w_dict]
return space.newtuple(lst)
@@ -520,7 +520,7 @@
if len(args_w) == 1:
self.w_code = args_w[0]
elif len(args_w) > 1:
- self.w_code = space.newtuple(args_w)
+ self.w_code = space.newtuple_imm(args_w)
W_BaseException.descr_init(self, space, args_w)
descr_init.unwrap_spec = ['self', ObjSpace, 'args_w']
Modified: pypy/branch/rlist-jit/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/objspace/std/typeobject.py (original)
+++ pypy/branch/rlist-jit/pypy/objspace/std/typeobject.py Wed Nov 10 17:23:07 2010
@@ -11,6 +11,7 @@
from pypy.rlib.objectmodel import current_object_addr_as_int, compute_hash
from pypy.rlib.jit import hint, purefunction_promote, we_are_jitted
from pypy.rlib.jit import dont_look_inside, purefunction
+from pypy.rlib.debug import list_not_modified_any_more
from pypy.rlib.rarithmetic import intmask, r_uint
from copy_reg import _HEAPTYPE
@@ -618,7 +619,7 @@
ensure_doc_attr(w_self)
if w_self.is_heaptype():
ensure_module_attr(w_self)
- w_self.mro_w = [] # temporarily
+ w_self.mro_w = list_not_modified_any_more([]) # temporarily
compute_mro(w_self)
def ensure_static_new(w_self):
Modified: pypy/branch/rlist-jit/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/objspace/std/typetype.py (original)
+++ pypy/branch/rlist-jit/pypy/objspace/std/typetype.py Wed Nov 10 17:23:07 2010
@@ -12,7 +12,7 @@
w_typetype = _precheck_for_new(space, w_typetype)
- bases_w = space.fixedview(w_bases)
+ bases_w = space.fixedview(w_bases)[:]
w_winner = w_typetype
for base in bases_w:
@@ -115,7 +115,7 @@
"can only assign tuple to %s.__bases__, not %s",
w_type.name,
space.type(w_value).getname(space, '?'))
- newbases_w = space.fixedview(w_value)
+ newbases_w = space.fixedview(w_value)[:]
if len(newbases_w) == 0:
raise operationerrfmt(space.w_TypeError,
"can only assign non-empty tuple to %s.__bases__, not ()",
Modified: pypy/branch/rlist-jit/pypy/rlib/debug.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/rlib/debug.py (original)
+++ pypy/branch/rlist-jit/pypy/rlib/debug.py Wed Nov 10 17:23:07 2010
@@ -247,6 +247,7 @@
# also annotated with a normal list.
assert not s_arg.listdef.listitem.must_not_mutate, (
"argument already has the flag 'must_not_mutate'")
+ s_arg.listdef.mutate()
# the logic behind it is that we try not to propagate
# make_sure_not_resized, when list comprehension is not on
if self.bookkeeper.annotator.translator.config.translation.list_comprehension_operations:
Modified: pypy/branch/rlist-jit/pypy/rlib/rsre/rsre_core.py
==============================================================================
--- pypy/branch/rlist-jit/pypy/rlib/rsre/rsre_core.py (original)
+++ pypy/branch/rlist-jit/pypy/rlib/rsre/rsre_core.py Wed Nov 10 17:23:07 2010
@@ -91,7 +91,7 @@
# and they must not be more than len(string).
check_nonneg(match_start)
check_nonneg(end)
- self.pattern = list_not_modified_any_more(pattern)
+ self.pattern = pattern
self.match_start = match_start
self.end = end
self.flags = flags
@@ -946,6 +946,7 @@
def match(pattern, string, start=0, end=sys.maxint, flags=0):
start, end = _adjust(start, end, len(string))
+ pattern = list_not_modified_any_more(pattern)
ctx = StrMatchContext(pattern, string, start, end, flags)
if match_context(ctx):
return ctx
@@ -954,6 +955,7 @@
def search(pattern, string, start=0, end=sys.maxint, flags=0):
start, end = _adjust(start, end, len(string))
+ pattern = list_not_modified_any_more(pattern)
ctx = StrMatchContext(pattern, string, start, end, flags)
if search_context(ctx):
return ctx
More information about the Pypy-commit
mailing list