[pypy-svn] r69458 - in pypy/trunk/pypy: annotation interpreter interpreter/astcompiler interpreter/astcompiler/tools interpreter/test module/__builtin__ module/__builtin__/test module/_codecs module/_rawffi module/_stackless/test module/micronumpy module/posix module/rctime module/select objspace/flow objspace/std objspace/std/test rpython

fijal at codespeak.net fijal at codespeak.net
Thu Nov 19 22:43:55 CET 2009


Author: fijal
Date: Thu Nov 19 22:43:52 2009
New Revision: 69458

Modified:
   pypy/trunk/pypy/annotation/bookkeeper.py
   pypy/trunk/pypy/interpreter/argument.py
   pypy/trunk/pypy/interpreter/astcompiler/ast.py
   pypy/trunk/pypy/interpreter/astcompiler/tools/asdl_py.py
   pypy/trunk/pypy/interpreter/baseobjspace.py
   pypy/trunk/pypy/interpreter/function.py
   pypy/trunk/pypy/interpreter/gateway.py
   pypy/trunk/pypy/interpreter/interactive.py
   pypy/trunk/pypy/interpreter/nestedscope.py
   pypy/trunk/pypy/interpreter/pycode.py
   pypy/trunk/pypy/interpreter/pyopcode.py
   pypy/trunk/pypy/interpreter/test/test_argument.py
   pypy/trunk/pypy/interpreter/test/test_compiler.py
   pypy/trunk/pypy/interpreter/test/test_objspace.py
   pypy/trunk/pypy/module/__builtin__/abstractinst.py
   pypy/trunk/pypy/module/__builtin__/interp_classobj.py
   pypy/trunk/pypy/module/__builtin__/test/test_abstractinst.py
   pypy/trunk/pypy/module/_codecs/interp_codecs.py
   pypy/trunk/pypy/module/_rawffi/interp_rawffi.py
   pypy/trunk/pypy/module/_rawffi/structure.py
   pypy/trunk/pypy/module/_stackless/test/test_pickle_infrastructure.py
   pypy/trunk/pypy/module/micronumpy/numarray.py
   pypy/trunk/pypy/module/posix/interp_posix.py
   pypy/trunk/pypy/module/rctime/interp_time.py
   pypy/trunk/pypy/module/select/interp_select.py
   pypy/trunk/pypy/objspace/flow/objspace.py
   pypy/trunk/pypy/objspace/std/dictmultiobject.py
   pypy/trunk/pypy/objspace/std/formatting.py
   pypy/trunk/pypy/objspace/std/inlinedict.py
   pypy/trunk/pypy/objspace/std/listobject.py
   pypy/trunk/pypy/objspace/std/marshal_impl.py
   pypy/trunk/pypy/objspace/std/objspace.py
   pypy/trunk/pypy/objspace/std/ropeobject.py
   pypy/trunk/pypy/objspace/std/ropeunicodeobject.py
   pypy/trunk/pypy/objspace/std/setobject.py
   pypy/trunk/pypy/objspace/std/stringobject.py
   pypy/trunk/pypy/objspace/std/strsliceobject.py
   pypy/trunk/pypy/objspace/std/test/test_dictmultiobject.py
   pypy/trunk/pypy/objspace/std/tupletype.py
   pypy/trunk/pypy/objspace/std/typeobject.py
   pypy/trunk/pypy/objspace/std/typetype.py
   pypy/trunk/pypy/objspace/std/unicodeobject.py
   pypy/trunk/pypy/rpython/callparse.py
Log:
Merge unpackiterable-improvements branch.

This branch splits viewiterable into two parts:
* fixedview, returns a non-resizable list, won't copy if w_obj is a W_TupleObj
* listview, returns a resizable list, won't copy if w_obj is a W_ListObj


Modified: pypy/trunk/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/trunk/pypy/annotation/bookkeeper.py	(original)
+++ pypy/trunk/pypy/annotation/bookkeeper.py	Thu Nov 19 22:43:52 2009
@@ -757,7 +757,8 @@
             getattr(s_obj, 'from_ellipsis', False)):    # see newtuple()
             return [Ellipsis]
         raise CallPatternTooComplex, "'*' argument must be SomeTuple"
-    viewiterable = unpackiterable
+    fixedview = unpackiterable
+    listview  = unpackiterable
 
     def is_w(self, one, other):
         return one is other

Modified: pypy/trunk/pypy/interpreter/argument.py
==============================================================================
--- pypy/trunk/pypy/interpreter/argument.py	(original)
+++ pypy/trunk/pypy/interpreter/argument.py	Thu Nov 19 22:43:52 2009
@@ -135,7 +135,7 @@
         # unpack the * arguments 
         if w_stararg is not None:
             self.arguments_w = (self.arguments_w +
-                                self.space.viewiterable(w_stararg))
+                                self.space.fixedview(w_stararg))
         # unpack the ** arguments
         if w_starstararg is not None:
             space = self.space

Modified: pypy/trunk/pypy/interpreter/astcompiler/ast.py
==============================================================================
--- pypy/trunk/pypy/interpreter/astcompiler/ast.py	(original)
+++ pypy/trunk/pypy/interpreter/astcompiler/ast.py	Thu Nov 19 22:43:52 2009
@@ -97,7 +97,7 @@
             pass
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -132,7 +132,7 @@
             pass
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -191,7 +191,7 @@
             pass
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -244,7 +244,7 @@
         self.args.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -254,7 +254,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_decorators
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.decorators = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -297,7 +297,7 @@
             pass
         w_list = self.w_bases
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.bases = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -307,7 +307,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -375,7 +375,7 @@
             pass
         w_list = self.w_targets
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.targets = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -415,7 +415,7 @@
             pass
         w_list = self.w_targets
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.targets = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -492,7 +492,7 @@
             self.dest.sync_app_attrs(space)
         w_list = self.w_values
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.values = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -540,7 +540,7 @@
         self.iter.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -550,7 +550,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_orelse
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.orelse = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -595,7 +595,7 @@
         self.test.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -605,7 +605,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_orelse
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.orelse = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -650,7 +650,7 @@
         self.test.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -660,7 +660,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_orelse
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.orelse = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -707,7 +707,7 @@
             self.optional_vars.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -795,7 +795,7 @@
             pass
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -805,7 +805,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_handlers
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.handlers = [space.interp_w(excepthandler, w_obj) for w_obj in list_w]
             else:
@@ -815,7 +815,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_orelse
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.orelse = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -857,7 +857,7 @@
             pass
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -867,7 +867,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_finalbody
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.finalbody = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -936,7 +936,7 @@
             pass
         w_list = self.w_names
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.names = [space.interp_w(alias, w_obj) for w_obj in list_w]
             else:
@@ -977,7 +977,7 @@
                 self.level = 0
         w_list = self.w_names
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.names = [space.interp_w(alias, w_obj) for w_obj in list_w]
             else:
@@ -1053,7 +1053,7 @@
             pass
         w_list = self.w_names
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.names = [space.str_w(w_obj) for w_obj in list_w]
             else:
@@ -1196,7 +1196,7 @@
             pass
         w_list = self.w_values
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.values = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1359,7 +1359,7 @@
             pass
         w_list = self.w_keys
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.keys = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1369,7 +1369,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_values
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.values = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1408,7 +1408,7 @@
         self.elt.sync_app_attrs(space)
         w_list = self.w_generators
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.generators = [space.interp_w(comprehension, w_obj) for w_obj in list_w]
             else:
@@ -1447,7 +1447,7 @@
         self.elt.sync_app_attrs(space)
         w_list = self.w_generators
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.generators = [space.interp_w(comprehension, w_obj) for w_obj in list_w]
             else:
@@ -1520,14 +1520,14 @@
         self.left.sync_app_attrs(space)
         w_list = self.w_ops
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.ops = [space.interp_w(cmpop, w_obj).to_simple_int(space) for w_obj in list_w]
             else:
                 self.ops = None
         w_list = self.w_comparators
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.comparators = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1579,7 +1579,7 @@
         self.func.sync_app_attrs(space)
         w_list = self.w_args
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.args = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1589,7 +1589,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_keywords
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.keywords = [space.interp_w(keyword, w_obj) for w_obj in list_w]
             else:
@@ -1795,7 +1795,7 @@
             pass
         w_list = self.w_elts
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.elts = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -1834,7 +1834,7 @@
             pass
         w_list = self.w_elts
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.elts = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -2012,7 +2012,7 @@
             pass
         w_list = self.w_dims
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.dims = [space.interp_w(slice, w_obj) for w_obj in list_w]
             else:
@@ -2305,7 +2305,7 @@
         self.iter.sync_app_attrs(space)
         w_list = self.w_ifs
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.ifs = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -2344,7 +2344,7 @@
             self.name.sync_app_attrs(space)
         w_list = self.w_body
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.body = [space.interp_w(stmt, w_obj) for w_obj in list_w]
             else:
@@ -2379,7 +2379,7 @@
                 self.kwarg = None
         w_list = self.w_args
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.args = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:
@@ -2389,7 +2389,7 @@
                 node.sync_app_attrs(space)
         w_list = self.w_defaults
         if w_list is not None:
-            list_w = space.viewiterable(w_list)
+            list_w = space.listview(w_list)
             if list_w:
                 self.defaults = [space.interp_w(expr, w_obj) for w_obj in list_w]
             else:

Modified: pypy/trunk/pypy/interpreter/astcompiler/tools/asdl_py.py
==============================================================================
--- pypy/trunk/pypy/interpreter/astcompiler/tools/asdl_py.py	(original)
+++ pypy/trunk/pypy/interpreter/astcompiler/tools/asdl_py.py	Thu Nov 19 22:43:52 2009
@@ -144,7 +144,7 @@
             if attr.seq:
                 self.emit("w_list = self.w_%s" % (attr.name,), 2)
                 self.emit("if w_list is not None:", 2)
-                self.emit("list_w = space.viewiterable(w_list)", 3)
+                self.emit("list_w = space.listview(w_list)", 3)
                 self.emit("if list_w:", 3)
                 unwrapper = get_unwrapper(attr.type.value, "w_obj",
                                           self.data.simple_types)

Modified: pypy/trunk/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/trunk/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/trunk/pypy/interpreter/baseobjspace.py	Thu Nov 19 22:43:52 2009
@@ -668,13 +668,17 @@
                                    (i, plural))
         return items
 
-    def viewiterable(self, w_iterable, expected_length=-1):
-        """ More or less the same as unpackiterable, but does not return
-        a copy. Please don't modify the result
+    def fixedview(self, w_iterable, expected_length=-1):
+        """ A fixed list view of w_iterable. Don't modify the result
         """
         return make_sure_not_resized(self.unpackiterable(w_iterable,
                                                          expected_length)[:])
 
+    def listview(self, w_iterable, expected_length=-1):
+        """ A non-fixed view of w_iterable. Don't modify the result
+        """
+        return self.unpackiterable(w_iterable, expected_length)
+
     def exception_match(self, w_exc_type, w_check_class):
         """Checks if the given exception type matches 'w_check_class'."""
         if self.is_w(w_exc_type, w_check_class):
@@ -771,7 +775,7 @@
     def lookup(self, w_obj, name):
         w_type = self.type(w_obj)
         w_mro = self.getattr(w_type, self.wrap("__mro__"))
-        for w_supertype in self.unpackiterable(w_mro):
+        for w_supertype in self.fixedview(w_mro):
             w_value = w_supertype.getdictvalue(self, name)
             if w_value is not None:
                 return w_value
@@ -880,7 +884,7 @@
         if self.is_true(self.isinstance(w_index_or_slice, self.w_slice)):
             w_indices = self.call_method(w_index_or_slice, "indices",
                                          self.wrap(seqlength))
-            w_start, w_stop, w_step = self.unpackiterable(w_indices, 3)
+            w_start, w_stop, w_step = self.fixedview(w_indices, 3)
             start = self.int_w(w_start)
             stop  = self.int_w(w_stop)
             step  = self.int_w(w_step)

Modified: pypy/trunk/pypy/interpreter/function.py
==============================================================================
--- pypy/trunk/pypy/interpreter/function.py	(original)
+++ pypy/trunk/pypy/interpreter/function.py	Thu Nov 19 22:43:52 2009
@@ -198,7 +198,7 @@
         else:
             name = None
         if not space.is_w(w_argdefs, space.w_None):
-            defs_w = space.viewiterable(w_argdefs)
+            defs_w = space.fixedview(w_argdefs)
         else:
             defs_w = []
         nfreevars = 0
@@ -316,7 +316,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.viewiterable(w_defs_w)
+        self.defs_w    = space.fixedview(w_defs_w)
         self.w_module = w_module
 
     def fget_func_defaults(space, self):
@@ -331,7 +331,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.viewiterable(w_defaults)
+        self.defs_w = space.fixedview(w_defaults)
 
     def fdel_func_defaults(space, self):
         self.defs_w = []

Modified: pypy/trunk/pypy/interpreter/gateway.py
==============================================================================
--- pypy/trunk/pypy/interpreter/gateway.py	(original)
+++ pypy/trunk/pypy/interpreter/gateway.py	Thu Nov 19 22:43:52 2009
@@ -210,7 +210,7 @@
                              % (self.scopenext(), self.scopenext()))
 
     def visit_args_w(self, el):
-        self.run_args.append("space.viewiterable(%s)" % self.scopenext())
+        self.run_args.append("space.fixedview(%s)" % self.scopenext())
 
     def visit_w_args(self, el):
         self.run_args.append(self.scopenext())
@@ -416,7 +416,7 @@
         #  baseobjspace.W_Root is for wrapped arguments to keep wrapped
         #  baseobjspace.Wrappable subclasses imply interp_w and a typecheck
         #  argument.Arguments is for a final rest arguments Arguments object
-        # 'args_w' for viewiterable applied to rest arguments
+        # 'args_w' for fixedview applied to rest arguments
         # 'w_args' for rest arguments passed as wrapped tuple
         # str,int,float: unwrap argument as such type
         # (function, cls) use function to check/unwrap argument of type cls

Modified: pypy/trunk/pypy/interpreter/interactive.py
==============================================================================
--- pypy/trunk/pypy/interpreter/interactive.py	(original)
+++ pypy/trunk/pypy/interpreter/interactive.py	Thu Nov 19 22:43:52 2009
@@ -73,7 +73,7 @@
         words = self.get_words(w_clz)
         try:                
             w_bases = s.getattr(w_clz, s.wrap("__bases__"))             
-            bases_w = s.viewiterable(w_bases)
+            bases_w = s.fixedview(w_bases)
 
         except error.OperationError:
             return words

Modified: pypy/trunk/pypy/interpreter/nestedscope.py
==============================================================================
--- pypy/trunk/pypy/interpreter/nestedscope.py	(original)
+++ pypy/trunk/pypy/interpreter/nestedscope.py	Thu Nov 19 22:43:52 2009
@@ -208,7 +208,7 @@
         if codeobj.magic >= 0xa0df281:    # CPython 2.5 AST branch merge
             w_freevarstuple = f.popvalue()
             freevars = [f.space.interp_w(Cell, cell)
-                        for cell in f.space.viewiterable(w_freevarstuple)]
+                        for cell in f.space.fixedview(w_freevarstuple)]
         else:
             nfreevars = len(codeobj.co_freevars)
             freevars = [f.space.interp_w(Cell, f.popvalue())

Modified: pypy/trunk/pypy/interpreter/pycode.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pycode.py	(original)
+++ pypy/trunk/pypy/interpreter/pycode.py	Thu Nov 19 22:43:52 2009
@@ -349,7 +349,7 @@
         if not space.is_true(space.isinstance(w_constants, space.w_tuple)):
             raise OperationError(space.w_TypeError,
                                  space.wrap("Expected tuple for constants"))
-        consts_w   = space.viewiterable(w_constants)
+        consts_w   = space.fixedview(w_constants)
         names      = unpack_str_tuple(space, w_names)
         varnames   = unpack_str_tuple(space, w_varnames)
         if w_freevars is not None:

Modified: pypy/trunk/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/trunk/pypy/interpreter/pyopcode.py	(original)
+++ pypy/trunk/pypy/interpreter/pyopcode.py	Thu Nov 19 22:43:52 2009
@@ -581,7 +581,7 @@
                                      w_compile_flags,
                                      f.space.wrap(f.get_builtin()),
                                      f.space.gettypeobject(PyCode.typedef))
-        w_prog, w_globals, w_locals = f.space.viewiterable(w_resulttuple, 3)
+        w_prog, w_globals, w_locals = f.space.fixedview(w_resulttuple, 3)
 
         plain = f.w_locals is not None and f.space.is_w(w_locals, f.w_locals)
         if plain:
@@ -637,7 +637,7 @@
     def UNPACK_SEQUENCE(f, itemcount, *ignored):
         w_iterable = f.popvalue()
         try:
-            items = f.space.viewiterable(w_iterable, itemcount)
+            items = f.space.fixedview(w_iterable, itemcount)
         except UnpackValueError, e:
             raise OperationError(f.space.w_ValueError, f.space.wrap(e.msg))
         f.pushrevvalues(itemcount, items)

Modified: pypy/trunk/pypy/interpreter/test/test_argument.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_argument.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_argument.py	Thu Nov 19 22:43:52 2009
@@ -60,9 +60,12 @@
     def is_true(self, obj):
         return bool(obj)
 
-    def viewiterable(self, it):
+    def fixedview(self, it):
         return list(it)
 
+    def listview(self, it):
+        return list(it)        
+
     def unpackiterable(self, it):
         return list(it)
 

Modified: pypy/trunk/pypy/interpreter/test/test_compiler.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_compiler.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_compiler.py	Thu Nov 19 22:43:52 2009
@@ -651,6 +651,9 @@
     elif sys.version_info < (2, 6):
         _unicode_error_kind = "w_UnicodeDecodeError"
     else:
+        def skip_on_2_6(self):
+            py.test.skip("syntax different on CPython 2.6 compiler")
+        test_globals_warnings = skip_on_2_6
         _unicode_error_kind = "w_SyntaxError"
 
 class TestPythonAstCompiler_25_grammar(BaseTestCompiler):

Modified: pypy/trunk/pypy/interpreter/test/test_objspace.py
==============================================================================
--- pypy/trunk/pypy/interpreter/test/test_objspace.py	(original)
+++ pypy/trunk/pypy/interpreter/test/test_objspace.py	Thu Nov 19 22:43:52 2009
@@ -58,14 +58,23 @@
         raises(ValueError, self.space.unpackiterable, w_l, 3)
         raises(ValueError, self.space.unpackiterable, w_l, 5)
 
-    def test_viewiterable(self):
+    def test_fixedview(self):
         w = self.space.wrap
         l = [w(1), w(2), w(3), w(4)]
         w_l = self.space.newtuple(l)
-        assert self.space.viewiterable(w_l) == l
-        assert self.space.viewiterable(w_l, 4) == l
-        raises(ValueError, self.space.viewiterable, w_l, 3)
-        raises(ValueError, self.space.viewiterable, w_l, 5)
+        assert self.space.fixedview(w_l) == l
+        assert self.space.fixedview(w_l, 4) == l
+        raises(ValueError, self.space.fixedview, w_l, 3)
+        raises(ValueError, self.space.fixedview, w_l, 5)
+
+    def test_listview(self):
+        w = self.space.wrap
+        l = [w(1), w(2), w(3), w(4)]
+        w_l = self.space.newtuple(l)
+        assert self.space.listview(w_l) == l
+        assert self.space.listview(w_l, 4) == l
+        raises(ValueError, self.space.listview, w_l, 3)
+        raises(ValueError, self.space.listview, w_l, 5)
 
     def test_exception_match(self):
         assert self.space.exception_match(self.space.w_ValueError,
@@ -207,7 +216,7 @@
 
         w_res = space.call_obj_args(w_f, w_9, Arguments(space, [w_1]))
 
-        w_x, w_y = space.viewiterable(w_res, 2)
+        w_x, w_y = space.fixedview(w_res, 2)
         assert w_x is w_9
         assert w_y is w_1
 

Modified: pypy/trunk/pypy/module/__builtin__/abstractinst.py
==============================================================================
--- pypy/trunk/pypy/module/__builtin__/abstractinst.py	(original)
+++ pypy/trunk/pypy/module/__builtin__/abstractinst.py	Thu Nov 19 22:43:52 2009
@@ -83,7 +83,7 @@
 def _abstract_isinstance_w_helper(space, w_obj, w_klass_or_tuple):
     # -- case (anything, tuple)
     if space.is_true(space.isinstance(w_klass_or_tuple, space.w_tuple)):
-        for w_klass in space.viewiterable(w_klass_or_tuple):
+        for w_klass in space.fixedview(w_klass_or_tuple):
             if abstract_isinstance_w(space, w_obj, w_klass):
                 return True
         return False
@@ -109,7 +109,7 @@
         return True
     w_bases = _get_bases(space, w_derived)
     if w_bases is not None:
-        for w_base in space.viewiterable(w_bases):
+        for w_base in space.fixedview(w_bases):
             if _issubclass_recurse(space, w_base, w_top):
                 return True
     return False
@@ -141,7 +141,7 @@
     # -- case (class-like-object, tuple-of-classes)
     # XXX it might be risky that the JIT sees this
     if space.is_true(space.isinstance(w_klass_or_tuple, space.w_tuple)):
-        for w_klass in space.viewiterable(w_klass_or_tuple):
+        for w_klass in space.fixedview(w_klass_or_tuple):
             if abstract_issubclass_w(space, w_derived, w_klass):
                 return True
         return False

Modified: pypy/trunk/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/trunk/pypy/module/__builtin__/interp_classobj.py	(original)
+++ pypy/trunk/pypy/module/__builtin__/interp_classobj.py	Thu Nov 19 22:43:52 2009
@@ -36,7 +36,7 @@
 
     # XXX missing: lengthy and obscure logic about "__module__"
         
-    bases_w = space.viewiterable(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)
@@ -79,7 +79,7 @@
             raise OperationError(
                     space.w_TypeError,
                     space.wrap("__bases__ must be a tuple object"))
-        bases_w = space.viewiterable(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,
@@ -285,7 +285,7 @@
         if not e.match(space, space.w_TypeError):
             raise
         return [None, None]
-    return space.viewiterable(w_tup, 2)
+    return space.fixedview(w_tup, 2)
 
 def descr_instance_new(space, w_type, w_class, w_dict=None):
     # w_type is not used at all

Modified: pypy/trunk/pypy/module/__builtin__/test/test_abstractinst.py
==============================================================================
--- pypy/trunk/pypy/module/__builtin__/test/test_abstractinst.py	(original)
+++ pypy/trunk/pypy/module/__builtin__/test/test_abstractinst.py	Thu Nov 19 22:43:52 2009
@@ -5,7 +5,7 @@
 
     def test_abstract_isclass(self):
         space = self.space
-        w_B1, w_B2, w_B3, w_X, w_Y = space.viewiterable(space.appexec([], """():
+        w_B1, w_B2, w_B3, w_X, w_Y = space.fixedview(space.appexec([], """():
             class X(object): pass
             class Y: pass
             B1, B2, B3 = X(), X(), X()
@@ -22,7 +22,7 @@
 
     def test_abstract_getclass(self):
         space = self.space
-        w_x, w_y, w_A, w_MyInst = space.viewiterable(space.appexec([], """():
+        w_x, w_y, w_A, w_MyInst = space.fixedview(space.appexec([], """():
             class MyInst(object):
                 def __init__(self, myclass):
                     self.myclass = myclass

Modified: pypy/trunk/pypy/module/_codecs/interp_codecs.py
==============================================================================
--- pypy/trunk/pypy/module/_codecs/interp_codecs.py	(original)
+++ pypy/trunk/pypy/module/_codecs/interp_codecs.py	Thu Nov 19 22:43:52 2009
@@ -35,7 +35,7 @@
                     space.wrap("encoding error handler must return "
                                "(unicode, int) tuple, not %s" % (
                                    space.str_w(space.repr(w_res)))))
-            w_replace, w_newpos = space.viewiterable(w_res, 2)
+            w_replace, w_newpos = space.fixedview(w_res, 2)
             newpos = space.int_w(w_newpos)
             if (newpos < 0):
                 newpos = len(input) + newpos

Modified: pypy/trunk/pypy/module/_rawffi/interp_rawffi.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/interp_rawffi.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/interp_rawffi.py	Thu Nov 19 22:43:52 2009
@@ -106,7 +106,7 @@
             resshape = cache.get_array_type(letter2tp(space, letter))
     else:
         letter = 'V'
-        w_shapetype, w_length = space.viewiterable(w_shape, expected_length=2)
+        w_shapetype, w_length = space.fixedview(w_shape, expected_length=2)
         from pypy.module._rawffi.structure import W_Structure
         resshape = space.interp_w(W_Structure, w_shapetype)
         ffi_type = resshape.get_ffi_type()
@@ -117,7 +117,7 @@
         letter = space.str_w(w_shape)
         return letter2tp(space, letter)
     else:
-        w_shapetype, w_length = space.viewiterable(w_shape, expected_length=2)
+        w_shapetype, w_length = space.fixedview(w_shape, expected_length=2)
         resshape = space.interp_w(W_DataShape, w_shapetype)
         length = space.int_w(w_length)
         size, alignment = resshape._size_alignment()
@@ -155,7 +155,7 @@
         """
         ffi_restype, resshape = unpack_resshape(space, w_restype)
         w = space.wrap
-        argtypes_w = space.viewiterable(w_argtypes)
+        argtypes_w = space.fixedview(w_argtypes)
         w_argtypes = space.newtuple(argtypes_w)
         w_key = space.newtuple([w_name, w_argtypes, w(resshape)])
         try:

Modified: pypy/trunk/pypy/module/_rawffi/structure.py
==============================================================================
--- pypy/trunk/pypy/module/_rawffi/structure.py	(original)
+++ pypy/trunk/pypy/module/_rawffi/structure.py	Thu Nov 19 22:43:52 2009
@@ -119,7 +119,7 @@
 
 def descr_new_structure(space, w_type, w_shapeinfo):
     if space.is_true(space.isinstance(w_shapeinfo, space.w_tuple)):
-        w_size, w_alignment = space.viewiterable(w_shapeinfo, expected_length=2)
+        w_size, w_alignment = space.fixedview(w_shapeinfo, expected_length=2)
         S = W_Structure(space, None, space.int_w(w_size),
                                      space.int_w(w_alignment))
     else:

Modified: pypy/trunk/pypy/module/_stackless/test/test_pickle_infrastructure.py
==============================================================================
--- pypy/trunk/pypy/module/_stackless/test/test_pickle_infrastructure.py	(original)
+++ pypy/trunk/pypy/module/_stackless/test/test_pickle_infrastructure.py	Thu Nov 19 22:43:52 2009
@@ -129,7 +129,7 @@
         return co, f, g
         """)
 
-        w_co, w_f, w_g = space.viewiterable(w_res)
+        w_co, w_f, w_g = space.fixedview(w_res)
 
         ec = space.getexecutioncontext()
         fcode = w_f.code.co_code
@@ -188,7 +188,7 @@
         return co, f, g
         """)
 
-        w_co, w_f, w_g = space.viewiterable(w_res)
+        w_co, w_f, w_g = space.fixedview(w_res)
 
         ec = space.getexecutioncontext()
         fcode = w_f.code.co_code
@@ -260,7 +260,7 @@
         return co, f, g
         """)
 
-        w_co, w_f, w_g = space.viewiterable(w_res)
+        w_co, w_f, w_g = space.fixedview(w_res)
 
         ec = space.getexecutioncontext()
         fcode = w_f.code.co_code

Modified: pypy/trunk/pypy/module/micronumpy/numarray.py
==============================================================================
--- pypy/trunk/pypy/module/micronumpy/numarray.py	(original)
+++ pypy/trunk/pypy/module/micronumpy/numarray.py	Thu Nov 19 22:43:52 2009
@@ -73,7 +73,7 @@
         make_sure_not_resized(self.storage)
 
     def _unpack_indexes(self, space, w_index):
-        indexes = [space.int_w(w_i) for w_i in space.viewiterable(w_index)]
+        indexes = [space.int_w(w_i) for w_i in space.fixedview(w_index)]
         if len(indexes) != len(self.dim):
             raise OperationError(space.w_IndexError, space.wrap(
                 'Wrong index'))
@@ -108,7 +108,7 @@
 def unpack_dim(space, w_dim):
     if space.is_true(space.isinstance(w_dim, space.w_int)):
         return [space.int_w(w_dim)]
-    dim_w = space.viewiterable(w_dim)
+    dim_w = space.fixedview(w_dim)
     return [space.int_w(w_i) for w_i in dim_w]
 
 def unpack_dtype(space, w_dtype):

Modified: pypy/trunk/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/trunk/pypy/module/posix/interp_posix.py	(original)
+++ pypy/trunk/pypy/module/posix/interp_posix.py	Thu Nov 19 22:43:52 2009
@@ -573,7 +573,7 @@
             raise wrap_oserror(space, e)
     try:
         msg = "utime() arg 2 must be a tuple (atime, mtime) or None"
-        args_w = space.unpackiterable(w_tuple)
+        args_w = space.fixedview(w_tuple)
         if len(args_w) != 2:
             raise OperationError(space.w_TypeError, space.wrap(msg))
         actime = space.float_w(args_w[0])

Modified: pypy/trunk/pypy/module/rctime/interp_time.py
==============================================================================
--- pypy/trunk/pypy/module/rctime/interp_time.py	(original)
+++ pypy/trunk/pypy/module/rctime/interp_time.py	Thu Nov 19 22:43:52 2009
@@ -222,7 +222,7 @@
                 space.wrap(_get_error_msg()))
         return pbuf
 
-    tup_w = space.unpackiterable(w_tup)
+    tup_w = space.fixedview(w_tup)
     if len(tup_w) != 9:
         raise OperationError(space.w_TypeError, 
                              space.wrap("argument must be sequence of "

Modified: pypy/trunk/pypy/module/select/interp_select.py
==============================================================================
--- pypy/trunk/pypy/module/select/interp_select.py	(original)
+++ pypy/trunk/pypy/module/select/interp_select.py	Thu Nov 19 22:43:52 2009
@@ -113,9 +113,9 @@
 On Windows, only sockets are supported; on Unix, all file descriptors.
 """
 
-    iwtd_w = space.unpackiterable(w_iwtd)
-    owtd_w = space.unpackiterable(w_owtd)
-    ewtd_w = space.unpackiterable(w_ewtd)
+    iwtd_w = space.listview(w_iwtd)
+    owtd_w = space.listview(w_owtd)
+    ewtd_w = space.listview(w_ewtd)
     iwtd = [as_fd_w(space, w_f) for w_f in iwtd_w]
     owtd = [as_fd_w(space, w_f) for w_f in owtd_w]
     ewtd = [as_fd_w(space, w_f) for w_f in ewtd_w]

Modified: pypy/trunk/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/flow/objspace.py	(original)
+++ pypy/trunk/pypy/objspace/flow/objspace.py	Thu Nov 19 22:43:52 2009
@@ -202,7 +202,7 @@
             # the simple case
             return ObjSpace.exception_match(self, w_exc_type, w_check_class)
         # checking a tuple of classes
-        for w_klass in self.viewiterable(w_check_class):
+        for w_klass in self.fixedview(w_check_class):
             if ObjSpace.exception_match(self, w_exc_type, w_klass):
                 return True
         return False
@@ -263,8 +263,9 @@
         checkgraph(graph)
         return graph
 
-    def viewiterable(self, w_tuple, expected_length=None):
+    def fixedview(self, w_tuple, expected_length=None):
         return self.unpackiterable(w_tuple, expected_length)
+    listview = fixedview
 
     def unpackiterable(self, w_iterable, expected_length=None):
         if not isinstance(w_iterable, Variable):

Modified: pypy/trunk/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/dictmultiobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/dictmultiobject.py	Thu Nov 19 22:43:52 2009
@@ -650,9 +650,9 @@
     if w_src is None:
         pass
     elif space.findattr(w_src, space.wrap("keys")) is None:
-        list_of_w_pairs = space.unpackiterable(w_src)
+        list_of_w_pairs = space.listview(w_src)
         for w_pair in list_of_w_pairs:
-            pair = space.unpackiterable(w_pair)
+            pair = space.fixedview(w_pair)
             if len(pair)!=2:
                 raise OperationError(space.w_ValueError,
                              space.wrap("dict() takes a sequence of pairs"))
@@ -793,7 +793,7 @@
         return w_default
 
 def dict_pop__DictMulti_ANY(space, w_dict, w_key, w_defaults):
-    defaults = space.unpackiterable(w_defaults)
+    defaults = space.listview(w_defaults)
     len_defaults = len(defaults)
     if len_defaults > 1:
         raise OperationError(space.w_TypeError, space.wrap("pop expected at most 2 arguments, got %d" % (1 + len_defaults, )))

Modified: pypy/trunk/pypy/objspace/std/formatting.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/formatting.py	(original)
+++ pypy/trunk/pypy/objspace/std/formatting.py	Thu Nov 19 22:43:52 2009
@@ -495,7 +495,7 @@
 
 def mod_format(space, w_format, w_values, do_unicode=False):
     if space.is_true(space.isinstance(w_values, space.w_tuple)):
-        values_w = space.unpackiterable(w_values)
+        values_w = space.fixedview(w_values)
         return format(space, w_format, values_w, None, do_unicode)
     else:
         # we check directly for dict to avoid obscure checking

Modified: pypy/trunk/pypy/objspace/std/inlinedict.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/inlinedict.py	(original)
+++ pypy/trunk/pypy/objspace/std/inlinedict.py	Thu Nov 19 22:43:52 2009
@@ -45,7 +45,7 @@
             # XXX sucky
             items = []
             for w_item in self.impl_items():
-                w_key, w_value = self.space.viewiterable(w_item)
+                w_key, w_value = self.space.fixedview(w_item)
                 items.append((w_key, w_value))
             return IndirectionIterImplementation(self.space, self, items)
 

Modified: pypy/trunk/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/listobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/listobject.py	Thu Nov 19 22:43:52 2009
@@ -260,11 +260,7 @@
     _setitem_slice_helper(space, w_list, start, step, slicelength, w_iterable)
 
 def _setitem_slice_helper(space, w_list, start, step, slicelength, w_iterable):
-    if isinstance(w_iterable, W_ListObject):
-        sequence2 = w_iterable.wrappeditems
-    else:
-        sequence2 = space.unpackiterable(w_iterable)
-
+    sequence2 = space.listview(w_iterable)
     assert slicelength >= 0
     items = w_list.wrappeditems
     oldsize = len(items)
@@ -357,7 +353,7 @@
     return space.w_None
 
 def list_extend__List_ANY(space, w_list, w_any):
-    w_list.wrappeditems += space.unpackiterable(w_any)
+    w_list.wrappeditems += space.listview(w_any)
     return space.w_None
 
 # note that the default value will come back wrapped!!!

Modified: pypy/trunk/pypy/objspace/std/marshal_impl.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/marshal_impl.py	(original)
+++ pypy/trunk/pypy/objspace/std/marshal_impl.py	Thu Nov 19 22:43:52 2009
@@ -356,7 +356,7 @@
 def marshal_w__DictMulti(space, w_dict, m):
     m.start(TYPE_DICT)
     for w_tuple in w_dict.items():
-        w_key, w_value = space.viewiterable(w_tuple, 2)
+        w_key, w_value = space.fixedview(w_tuple, 2)
         m.put_w_obj(w_key)
         m.put_w_obj(w_value)
     m.atom(TYPE_NULL)
@@ -469,14 +469,14 @@
 def marshal_w_set(space, w_set, m):
     # cannot access this list directly, because it's
     # type is not exactly known through applevel.
-    lis_w = space.viewiterable(w_set)
+    lis_w = space.fixedview(w_set)
     m.put_tuple_w(TYPE_SET, lis_w)
 
 handled_by_any.append( ('set', marshal_w_set) )
 
 # not directly supported:
 def marshal_w_frozenset(space, w_frozenset, m):
-    lis_w = space.viewiterable(w_frozenset)
+    lis_w = space.fixedview(w_frozenset)
     m.put_tuple_w(TYPE_FROZENSET, lis_w)
 
 handled_by_any.append( ('frozenset', marshal_w_frozenset) )

Modified: pypy/trunk/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/objspace.py	(original)
+++ pypy/trunk/pypy/objspace/std/objspace.py	Thu Nov 19 22:43:52 2009
@@ -383,7 +383,7 @@
             space = self
             # too early for unpackiterable as well :-(
             name  = space.unwrap(space.getitem(w_args, space.wrap(0)))
-            bases = space.viewiterable(space.getitem(w_args, space.wrap(1)))
+            bases = space.fixedview(space.getitem(w_args, space.wrap(1)))
             dic   = space.unwrap(space.getitem(w_args, space.wrap(2)))
             dic = dict([(key,space.wrap(value)) for (key, value) in dic.items()])
             bases = list(bases)
@@ -643,7 +643,7 @@
             raise UnpackValueError("Expected length %d, got %d" % (expected_length, len(t)))
         return t
 
-    def viewiterable(self, w_obj, expected_length=-1):
+    def fixedview(self, w_obj, expected_length=-1):
         """ Fast paths
         """
         if isinstance(w_obj, W_TupleObject):
@@ -651,7 +651,18 @@
         elif isinstance(w_obj, W_ListObject):
             t = w_obj.wrappeditems[:]
         else:
-            return ObjSpace.viewiterable(self, w_obj, expected_length)
+            return ObjSpace.fixedview(self, w_obj, expected_length)
+        if expected_length != -1 and len(t) != expected_length:
+            raise UnpackValueError("Expected length %d, got %d" % (expected_length, len(t)))
+        return t
+
+    def listview(self, w_obj, expected_length=-1):
+        if isinstance(w_obj, W_ListObject):
+            t = w_obj.wrappeditems
+        elif isinstance(w_obj, W_TupleObject):
+            t = w_obj.wrappeditems[:]
+        else:
+            return ObjSpace.listview(self, w_obj, expected_length)
         if expected_length != -1 and len(t) != expected_length:
             raise UnpackValueError("Expected length %d, got %d" % (expected_length, len(t)))
         return t

Modified: pypy/trunk/pypy/objspace/std/ropeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/ropeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/ropeobject.py	Thu Nov 19 22:43:52 2009
@@ -537,7 +537,7 @@
     (self, _, start, end) = _convert_idx_params(space, w_self,
                                                 W_RopeObject.EMPTY, w_start,
                                                 w_end, True)
-    for w_suffix in space.viewiterable(w_suffixes):
+    for w_suffix in space.fixedview(w_suffixes):
         if space.is_true(space.isinstance(w_suffix, space.w_unicode)):
             w_u = space.call_function(space.w_unicode, w_self)
             return space.call_method(w_u, "endswith", w_suffixes, w_start,
@@ -557,7 +557,7 @@
 def str_startswith__Rope_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
     (self, _, start, end) = _convert_idx_params(space, w_self, W_RopeObject.EMPTY,
                                                   w_start, w_end, True)
-    for w_prefix in space.viewiterable(w_prefixes):
+    for w_prefix in space.fixedview(w_prefixes):
         if space.is_true(space.isinstance(w_prefix, space.w_unicode)):
             w_u = space.call_function(space.w_unicode, w_self)
             return space.call_method(w_u, "startswith", w_prefixes, w_start,

Modified: pypy/trunk/pypy/objspace/std/ropeunicodeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/ropeunicodeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/ropeunicodeobject.py	Thu Nov 19 22:43:52 2009
@@ -233,7 +233,7 @@
     return space.contains(unicode_from_string(space, w_container), w_item )
 
 def unicode_join__RopeUnicode_ANY(space, w_self, w_list):
-    l_w = space.unpackiterable(w_list)
+    l_w = space.listview(w_list)
     delim = w_self._node
     totlen = 0
     if len(l_w) == 0:
@@ -504,7 +504,7 @@
 def unicode_startswith__RopeUnicode_Tuple_ANY_ANY(space, w_unistr, w_prefixes,
                                               w_start, w_end):
     unistr, start, end = _convert_idx_params(space, w_unistr, w_start, w_end)
-    for w_prefix in space.viewiterable(w_prefixes):
+    for w_prefix in space.fixedview(w_prefixes):
         prefix = ropeunicode_w(space, w_prefix)
         if rope.startswith(unistr, prefix, start, end):
             return space.w_True
@@ -513,7 +513,7 @@
 def unicode_endswith__RopeUnicode_Tuple_ANY_ANY(space, w_unistr, w_suffixes,
                                             w_start, w_end):
     unistr, start, end = _convert_idx_params(space, w_unistr, w_start, w_end)
-    for w_suffix in space.viewiterable(w_suffixes):
+    for w_suffix in space.fixedview(w_suffixes):
         suffix = ropeunicode_w(space, w_suffix)
         if rope.endswith(unistr, suffix, start, end):
             return space.w_True

Modified: pypy/trunk/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/setobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/setobject.py	Thu Nov 19 22:43:52 2009
@@ -111,7 +111,7 @@
 def make_setdata_from_w_iterable(space, w_iterable=None):
     data = r_dict(space.eq_w, space.hash_w)
     if w_iterable is not None:
-        for w_item in space.viewiterable(w_iterable):
+        for w_item in space.listview(w_iterable):
             data[w_item] = None
     return data
 

Modified: pypy/trunk/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/stringobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/stringobject.py	Thu Nov 19 22:43:52 2009
@@ -349,7 +349,7 @@
                                                        sliced)
 
 def str_join__String_ANY(space, w_self, w_list):
-    list_w = space.unpackiterable(w_list)
+    list_w = space.listview(w_list)
     str_w = space.str_w
     if list_w:
         self = w_self._value
@@ -628,7 +628,7 @@
     (u_self, _, start, end) = _convert_idx_params(space, w_self,
                                                   space.wrap(''), w_start,
                                                   w_end, True)
-    for w_suffix in space.viewiterable(w_suffixes):
+    for w_suffix in space.fixedview(w_suffixes):
         if space.is_true(space.isinstance(w_suffix, space.w_unicode)):
             w_u = space.call_function(space.w_unicode, w_self)
             return space.call_method(w_u, "endswith", w_suffixes, w_start,
@@ -647,7 +647,7 @@
 def str_startswith__String_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
     (u_self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(''),
                                                   w_start, w_end, True)
-    for w_prefix in space.viewiterable(w_prefixes):
+    for w_prefix in space.fixedview(w_prefixes):
         if space.is_true(space.isinstance(w_prefix, space.w_unicode)):
             w_u = space.call_function(space.w_unicode, w_self)
             return space.call_method(w_u, "startswith", w_prefixes, w_start,

Modified: pypy/trunk/pypy/objspace/std/strsliceobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/strsliceobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/strsliceobject.py	Thu Nov 19 22:43:52 2009
@@ -143,7 +143,7 @@
 def str_endswith__StringSlice_Tuple_ANY_ANY(space, w_self, w_suffixes, w_start, w_end):
     (u_self, _, start, end) = _convert_idx_params(space, w_self,
                                                   space.wrap(''), w_start, w_end)
-    for w_suffix in space.viewiterable(w_suffixes):
+    for w_suffix in space.fixedview(w_suffixes):
         suffix = space.str_w(w_suffix) 
         if stringendswith(u_self, suffix, start, end):
             return space.w_True
@@ -157,7 +157,7 @@
 def str_startswith__StringSlice_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
     (u_self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(''),
                                                   w_start, w_end)
-    for w_prefix in space.viewiterable(w_prefixes):
+    for w_prefix in space.fixedview(w_prefixes):
         prefix = space.str_w(w_prefix)
         if stringstartswith(u_self, prefix, start, end):
             return space.w_True

Modified: pypy/trunk/pypy/objspace/std/test/test_dictmultiobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/test/test_dictmultiobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/test/test_dictmultiobject.py	Thu Nov 19 22:43:52 2009
@@ -607,8 +607,8 @@
     StringObjectCls = FakeString
     w_dict = None
     iter = iter
-    viewiterable = list
-
+    fixedview = list
+    listview  = list
 
 class Config:
     class objspace:

Modified: pypy/trunk/pypy/objspace/std/tupletype.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/tupletype.py	(original)
+++ pypy/trunk/pypy/objspace/std/tupletype.py	Thu Nov 19 22:43:52 2009
@@ -13,7 +13,7 @@
           space.is_w(space.type(w_sequence), space.w_tuple)):
         return w_sequence
     else:
-        tuple_w = space.viewiterable(w_sequence)
+        tuple_w = space.fixedview(w_sequence)
     w_obj = space.allocate_instance(space.TupleObjectCls, w_tupletype)
     space.TupleObjectCls.__init__(w_obj, tuple_w)
     return w_obj

Modified: pypy/trunk/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/typeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/typeobject.py	Thu Nov 19 22:43:52 2009
@@ -596,7 +596,7 @@
         if not space.is_w(w_where, space.w_type):
             w_mro_meth = space.get(w_mro_func, w_self)
             w_mro = space.call_function(w_mro_meth)
-            mro_w = space.viewiterable(w_mro)
+            mro_w = space.fixedview(w_mro)
             w_self.mro_w = validate_custom_mro(space, mro_w)
             return    # done
     w_self.mro_w = w_self.compute_default_mro()[:]

Modified: pypy/trunk/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/typetype.py	(original)
+++ pypy/trunk/pypy/objspace/std/typetype.py	Thu Nov 19 22:43:52 2009
@@ -11,7 +11,7 @@
 
     w_typetype = _precheck_for_new(space, w_typetype)
     
-    bases_w = space.viewiterable(w_bases)
+    bases_w = space.fixedview(w_bases)
 
     w_winner = w_typetype
     for base in bases_w:
@@ -38,7 +38,7 @@
     name = space.str_w(w_name)
     assert isinstance(name, str)
     dict_w = {}
-    dictkeys_w = space.unpackiterable(w_dict)
+    dictkeys_w = space.listview(w_dict)
     for w_key in dictkeys_w:
         key = space.str_w(w_key)
         dict_w[key] = space.getitem(w_dict, w_key)
@@ -115,7 +115,7 @@
                                         " to %s.__bases__, not %s"%
                                     (w_type.name,
                                      space.type(w_value).getname(space, '?'))))
-    newbases_w = space.viewiterable(w_value)
+    newbases_w = space.fixedview(w_value)
     if len(newbases_w) == 0:
         raise OperationError(space.w_TypeError,
                              space.wrap("can only assign non-empty tuple"

Modified: pypy/trunk/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/trunk/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/unicodeobject.py	Thu Nov 19 22:43:52 2009
@@ -173,7 +173,7 @@
     return space.newbool(container.find(item) != -1)
 
 def unicode_join__Unicode_ANY(space, w_self, w_list):
-    l = space.unpackiterable(w_list)
+    l = space.listview(w_list)
     delim = w_self._value
     totlen = 0
     if len(l) == 0:
@@ -489,7 +489,7 @@
                                               w_start, w_end):
     unistr, _, start, end = _convert_idx_params(space, w_unistr, space.wrap(u''),
                                                 w_start, w_end, True)
-    for w_prefix in space.viewiterable(w_prefixes):
+    for w_prefix in space.fixedview(w_prefixes):
         prefix = space.unicode_w(w_prefix)
         if stringstartswith(unistr, prefix, start, end):
             return space.w_True
@@ -499,7 +499,7 @@
                                             w_start, w_end):
     unistr, _, start, end = _convert_idx_params(space, w_unistr, space.wrap(u''),
                                              w_start, w_end, True)
-    for w_suffix in space.viewiterable(w_suffixes):
+    for w_suffix in space.fixedview(w_suffixes):
         suffix = space.unicode_w(w_suffix)
         if stringendswith(unistr, suffix, start, end):
             return space.w_True

Modified: pypy/trunk/pypy/rpython/callparse.py
==============================================================================
--- pypy/trunk/pypy/rpython/callparse.py	(original)
+++ pypy/trunk/pypy/rpython/callparse.py	Thu Nov 19 22:43:52 2009
@@ -178,7 +178,8 @@
                 raise ValueError
             return list(items)
         raise CallPatternTooComplex, "'*' argument must be a tuple"
-    viewiterable = unpackiterable
+    fixedview = unpackiterable
+    listview = unpackiterable
 
     def is_w(self, one, other):
         return one is other



More information about the Pypy-commit mailing list