[pypy-svn] r69484 - in pypy/branch/shorter-guard-path/pypy: annotation config doc/config interpreter interpreter/astcompiler interpreter/astcompiler/tools interpreter/test module/Numeric module/__builtin__ module/__builtin__/test module/_codecs module/_rawffi module/_stackless/test module/micronumpy module/oracle module/oracle/test module/posix module/rctime module/select objspace/flow objspace/std objspace/std/test rpython translator/c/gcc

arigo at codespeak.net arigo at codespeak.net
Fri Nov 20 21:35:08 CET 2009


Author: arigo
Date: Fri Nov 20 21:35:04 2009
New Revision: 69484

Removed:
   pypy/branch/shorter-guard-path/pypy/doc/config/objspace.usemodules.Numeric.txt
   pypy/branch/shorter-guard-path/pypy/module/Numeric/
Modified:
   pypy/branch/shorter-guard-path/pypy/annotation/bookkeeper.py
   pypy/branch/shorter-guard-path/pypy/config/translationoption.py
   pypy/branch/shorter-guard-path/pypy/interpreter/argument.py
   pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/ast.py
   pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/tools/asdl_py.py
   pypy/branch/shorter-guard-path/pypy/interpreter/baseobjspace.py
   pypy/branch/shorter-guard-path/pypy/interpreter/function.py
   pypy/branch/shorter-guard-path/pypy/interpreter/gateway.py
   pypy/branch/shorter-guard-path/pypy/interpreter/interactive.py
   pypy/branch/shorter-guard-path/pypy/interpreter/nestedscope.py
   pypy/branch/shorter-guard-path/pypy/interpreter/pycode.py
   pypy/branch/shorter-guard-path/pypy/interpreter/pyopcode.py
   pypy/branch/shorter-guard-path/pypy/interpreter/test/test_argument.py
   pypy/branch/shorter-guard-path/pypy/interpreter/test/test_compiler.py
   pypy/branch/shorter-guard-path/pypy/interpreter/test/test_objspace.py
   pypy/branch/shorter-guard-path/pypy/module/__builtin__/abstractinst.py
   pypy/branch/shorter-guard-path/pypy/module/__builtin__/interp_classobj.py
   pypy/branch/shorter-guard-path/pypy/module/__builtin__/test/test_abstractinst.py
   pypy/branch/shorter-guard-path/pypy/module/_codecs/interp_codecs.py
   pypy/branch/shorter-guard-path/pypy/module/_rawffi/interp_rawffi.py
   pypy/branch/shorter-guard-path/pypy/module/_rawffi/structure.py
   pypy/branch/shorter-guard-path/pypy/module/_stackless/test/test_pickle_infrastructure.py
   pypy/branch/shorter-guard-path/pypy/module/micronumpy/numarray.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/__init__.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/config.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/interp_connect.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/interp_cursor.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/interp_error.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/interp_variable.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/roci.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_connect.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_cursor.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_datetimevar.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_numbervar.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_select.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_stringvar.py
   pypy/branch/shorter-guard-path/pypy/module/oracle/transform.py
   pypy/branch/shorter-guard-path/pypy/module/posix/interp_posix.py
   pypy/branch/shorter-guard-path/pypy/module/rctime/interp_time.py
   pypy/branch/shorter-guard-path/pypy/module/select/interp_select.py
   pypy/branch/shorter-guard-path/pypy/objspace/flow/objspace.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/dictmultiobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/floatobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/formatting.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/inlinedict.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/listobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/marshal_impl.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/objspace.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/ropeobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/ropeunicodeobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/setobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/stringobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/strsliceobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_celldict.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_dictmultiobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_floatobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_userobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/tupletype.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/typeobject.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/typetype.py
   pypy/branch/shorter-guard-path/pypy/objspace/std/unicodeobject.py
   pypy/branch/shorter-guard-path/pypy/rpython/callparse.py
   pypy/branch/shorter-guard-path/pypy/translator/c/gcc/trackgcroot.py
Log:
Merge the trunk.  Fixes a failure.
svn merge -r69393:69483 svn+ssh://codespeak.net/svn/pypy/trunk



Modified: pypy/branch/shorter-guard-path/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/annotation/bookkeeper.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/annotation/bookkeeper.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/config/translationoption.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/config/translationoption.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/config/translationoption.py	Fri Nov 20 21:35:04 2009
@@ -245,7 +245,7 @@
                    "Tranform graphs in SSI form into graphs tailored for "
                    "stack based virtual machines (only for backends that support it)",
                    default=True),
-        BoolOption("storesink", "Perform store sinking", default=False),
+        BoolOption("storesink", "Perform store sinking", default=True),
         BoolOption("none",
                    "Do not run any backend optimizations",
                    requires=[('translation.backendopt.inline', False),

Modified: pypy/branch/shorter-guard-path/pypy/interpreter/argument.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/argument.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/argument.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/astcompiler/ast.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/ast.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/ast.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/astcompiler/tools/asdl_py.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/tools/asdl_py.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/astcompiler/tools/asdl_py.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/baseobjspace.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/function.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/function.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/function.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/gateway.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/gateway.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/gateway.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/interactive.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/interactive.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/interactive.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/nestedscope.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/nestedscope.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/nestedscope.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/pycode.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/pycode.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/pycode.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/pyopcode.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/pyopcode.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/test/test_argument.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/test/test_argument.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/test/test_argument.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/test/test_compiler.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/test/test_compiler.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/test/test_compiler.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/interpreter/test/test_objspace.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/interpreter/test/test_objspace.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/interpreter/test/test_objspace.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/__builtin__/abstractinst.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/__builtin__/abstractinst.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/__builtin__/abstractinst.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/__builtin__/interp_classobj.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/__builtin__/interp_classobj.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/__builtin__/interp_classobj.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/__builtin__/test/test_abstractinst.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/__builtin__/test/test_abstractinst.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/__builtin__/test/test_abstractinst.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/_codecs/interp_codecs.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/_codecs/interp_codecs.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/_codecs/interp_codecs.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/_rawffi/interp_rawffi.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/_rawffi/interp_rawffi.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/_rawffi/interp_rawffi.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/_rawffi/structure.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/_rawffi/structure.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/_rawffi/structure.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/_stackless/test/test_pickle_infrastructure.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/_stackless/test/test_pickle_infrastructure.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/_stackless/test/test_pickle_infrastructure.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/micronumpy/numarray.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/micronumpy/numarray.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/micronumpy/numarray.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/oracle/__init__.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/__init__.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/__init__.py	Fri Nov 20 21:35:04 2009
@@ -9,7 +9,13 @@
         'NUMBER': 'interp_variable.VT_Float',
         'STRING': 'interp_variable.VT_String',
         'DATETIME': 'interp_variable.VT_DateTime',
+        'BINARY': 'interp_variable.VT_Binary',
+        'LONG_STRING': 'interp_variable.VT_LongString',
+        'LONG_BINARY': 'interp_variable.VT_LongBinary',
+        'FIXED_CHAR': 'interp_variable.VT_FixedChar',
         'Variable': 'interp_variable.W_Variable',
+        'Timestamp': 'interp_error.get(space).w_DateTimeType',
+        'Date': 'interp_error.get(space).w_DateType',
     }
 
     appleveldefs = {

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/config.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/config.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/config.py	Fri Nov 20 21:35:04 2009
@@ -3,6 +3,7 @@
 WITH_UNICODE = False
 
 MAX_STRING_CHARS = 4000
+MAX_BINARY_BYTES = 4000
 
 if WITH_UNICODE:
     CHARSETID = roci.OCI_UTF16ID

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/interp_connect.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/interp_connect.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/interp_connect.py	Fri Nov 20 21:35:04 2009
@@ -12,6 +12,7 @@
 from pypy.module.oracle.config import string_w, StringBuffer, MAX_STRING_CHARS
 from pypy.module.oracle.interp_environ import Environment
 from pypy.module.oracle.interp_cursor import W_Cursor
+from pypy.module.oracle.interp_pool import W_Pool
 from pypy.module.oracle.interp_variable import VT_String
 
 class W_Connection(Wrappable):
@@ -42,7 +43,7 @@
         W_Connection.__init__(self)
 
         # set up the environment
-        if w_pool:
+        if 0 and w_pool: # XXX
             pool = space.instance_w(W_Pool, w_pool)
             self.environment = pool.environment.clone()
         else:
@@ -55,13 +56,13 @@
         # perform some parsing, if necessary
         if (self.w_username and not self.w_password and
             space.is_true(space.contains(self.w_username, space.wrap('/')))):
-            (self.w_username, self.w_password) = space.unpackiterable(
+            (self.w_username, self.w_password) = space.listview(
                 space.call_method(self.w_username, 'split',
                                   space.wrap('/'), space.wrap(1)))
-            
+
         if (self.w_password and not self.w_tnsentry and
             space.is_true(space.contains(self.w_password, space.wrap('@')))):
-            (self.w_password, self.w_tnsentry) = space.unpackiterable(
+            (self.w_password, self.w_tnsentry) = space.listview(
                 space.call_method(self.w_password, 'split',
                                   space.wrap('@'), space.wrap(1)))
 
@@ -149,6 +150,8 @@
         finally:
             lltype.free(handleptr, flavor='raw')
 
+        credentialType = roci.OCI_CRED_EXT
+
         # set user name in session handle
         stringBuffer.fill(space, self.w_username)
         try:
@@ -263,32 +266,51 @@
 
     def _getCharacterSetName(self, space, attribute):
         # get character set id
-        status = roci.OCIAttrGet(
-            self.environment.handle, roci.HTYPE_ENV,
-            charsetId, None,
-            attribute,
-            self.environment.errorHandle)
-        self.environment.checkForError(
-            status, "Connection_GetCharacterSetName(): get charset id")
+        charsetIdPtr = lltype.malloc(rffi.CArrayPtr(roci.ub2).TO,
+                                  1, flavor='raw')
+        try:
+            status = roci.OCIAttrGet(
+                self.environment.handle, roci.OCI_HTYPE_ENV,
+                rffi.cast(roci.dvoidp, charsetIdPtr),
+                lltype.nullptr(roci.Ptr(roci.ub4).TO),
+                attribute,
+                self.environment.errorHandle)
+            self.environment.checkForError(
+                status, "Connection_GetCharacterSetName(): get charset id")
+            charsetId = charsetIdPtr[0]
+        finally:
+            lltype.free(charsetIdPtr, flavor='raw')
 
         # get character set name
-        status = roci.OCINlsCharsetIdToName(
-            self.environmentHandle,
-            charsetNameBuf.buf, charsetNameBuf.size,
-            charsetIdPtr[0])
-        self.environment.checkForError(
-            status, "Connection_GetCharacterSetName(): get Oracle charset name")
+        charsetname_buf, charsetname = rffi.alloc_buffer(roci.OCI_NLS_MAXBUFSZ)
+        try:
+            status = roci.OCINlsCharSetIdToName(
+                self.environment.handle,
+                charsetname_buf, roci.OCI_NLS_MAXBUFSZ,
+                charsetId)
+            self.environment.checkForError(
+                status,
+                "Connection_GetCharacterSetName(): get Oracle charset name")
 
-        # get IANA character set name
-        status = roci.OCINlsNameMap(
-            self.environmentHandle,
-            ianaCharsetNameBuf.buf, inaCharsetNameBuf.size,
-            charsetNameBuf.buf, roci.OCI_NLS_CS_ORA_TO_IANA)
-        self.environment.checkForError(
-            status, "Connection_GetCharacterSetName(): translate NLS charset")
+            ianacharset_buf, ianacharset = rffi.alloc_buffer(
+                roci.OCI_NLS_MAXBUFSZ)
+
+            try:
+                # get IANA character set name
+                status = roci.OCINlsNameMap(
+                    self.environment.handle,
+                    ianacharset_buf, roci.OCI_NLS_MAXBUFSZ,
+                    charsetname_buf, roci.OCI_NLS_CS_ORA_TO_IANA)
+                self.environment.checkForError(
+                    status,
+                    "Connection_GetCharacterSetName(): translate NLS charset")
+                charset = rffi.charp2str(ianacharset_buf)
+            finally:
+                rffi.keep_buffer_alive_until_here(ianacharset_buf, ianacharset)
+        finally:
+            rffi.keep_buffer_alive_until_here(charsetname_buf, charsetname)
+        return space.wrap(charset)
 
-        return space.wrap(ianaCharsetName) 
-        
     def get_encoding(space, self):
         return self._getCharacterSetName(space, roci.OCI_ATTR_ENV_CHARSET_ID)
     def get_nationalencoding(space, self):
@@ -302,7 +324,7 @@
             return self.w_version
 
         # allocate a cursor to retrieve the version
-        cursor = self.newCursor(space)
+        cursor = W_Cursor(space, self)
 
         # allocate version and compatibility variables
         versionVar = VT_String(cursor, cursor.arraySize, MAX_STRING_CHARS)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/interp_cursor.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/interp_cursor.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/interp_cursor.py	Fri Nov 20 21:35:04 2009
@@ -29,6 +29,8 @@
         self.bindList = None
         self.bindDict = None
         self.numbersAsStrings = False
+        self.outputSize = -1
+        self.outputSizeColumn = -1
 
         self.inputTypeHandler = None
         self.outputTypeHandler = None
@@ -126,19 +128,20 @@
         # queries are not supported as the result is undefined
         if self.statementType == roci.OCI_STMT_SELECT:
             raise OperationError(
-                w_NotSupportedErrorException,
+                get(space).w_NotSupportedErrorException,
                 space.wrap("queries not supported: results undefined"))
 
         # perform binds
-        numrows = space.int_w(space.len(w_list_of_args))
-        for i, arguments in enumerate(space.viewiterable(w_list_of_args)):
+        args_w = space.listview(w_list_of_args)
+        numrows = len(args_w)
+        for i, w_arguments in enumerate(args_w):
             deferred = i < numrows - 1
-            if space.is_true(space.isinstance(arguments, space.w_dict)):
+            if space.is_true(space.isinstance(w_arguments, space.w_dict)):
                 self._setBindVariablesByName(
-                    space, arguments, numrows, i, deferred)
+                    space, w_arguments, numrows, i, deferred)
             else:
                 self._setBindVariablesByPos(
-                    space, arguments, numrows, i, deferred)
+                    space, w_arguments, numrows, i, deferred)
         self._performBind(space)
 
         # execute the statement, but only if the number of rows is greater than
@@ -205,8 +208,8 @@
             w_vars = w_args
 
         # build up the statement
-        args = ', '.join(':%d' % (i + offset + 1,)
-                         for i in range(numArguments))
+        args = ', '.join([':%d' % (i + offset + 1,)
+                          for i in range(numArguments)])
         if retvar:
             stmt = "begin :1 := %s(%s); end;" % (name, args)
         else:
@@ -224,7 +227,7 @@
         if not self.handle:
             return
         if self.isOwned:
-            roci.OciHandleFree(self.handle, OCI_HTYPE_STMT)
+            roci.OCIHandleFree(self.handle, roci.OCI_HTYPE_STMT)
         elif self.connection.handle:
             tagBuffer = StringBuffer()
             tagBuffer.fill(space, self.w_statementTag)
@@ -544,7 +547,7 @@
         if self.bindList is None:
             self.bindList = []
 
-        for i, w_value in enumerate(space.viewiterable(w_vars)):
+        for i, w_value in enumerate(space.fixedview(w_vars)):
             if i < len(self.bindList):
                 origVar = self.bindList[i]
                 if space.is_w(origVar, space.w_None):
@@ -572,9 +575,9 @@
         if self.bindDict is None:
             self.bindDict = space.newdict()
 
-        items = space.viewiterable(space.call_method(w_vars, "iteritems"))
+        items = space.fixedview(space.call_method(w_vars, "iteritems"))
         for item in items:
-            w_key, w_value = space.viewiterable(item, 2)
+            w_key, w_value = space.fixedview(item, 2)
             origVar = space.finditem(self.bindDict, w_key)
             newVar = self._setBindVariableHelper(space, w_value, origVar,
                                                  numElements, arrayPos, defer)
@@ -641,10 +644,10 @@
             for i, var in enumerate(self.bindList):
                 var.bind(space, self, None, i + 1)
         if self.bindDict:
-            items = space.viewiterable(
+            items_w = space.fixedview(
                 space.call_method(self.bindDict, "iteritems"))
-            for item in items:
-                w_key, var = space.viewiterable(item, 2)
+            for w_item in items_w:
+                w_key, var = space.fixedview(w_item, 2)
                 var.bind(space, self, w_key, 0)
 
         # ensure that input sizes are reset
@@ -733,6 +736,18 @@
         return space.w_None
     fetchone.unwrap_spec = ['self', ObjSpace]
 
+    def fetchmany(self, space, w_numRows=NoneNotWrapped):
+        if w_numRows is not None:
+            numRows = space.int_w(w_numRows)
+        else:
+            numRows = self.arraySize
+
+        # verify fetch can be performed
+        self._verifyFetch(space)
+
+        return self._multiFetch(space, limit=numRows)
+    fetchmany.unwrap_spec = ['self', ObjSpace, W_Root]
+
     def fetchall(self, space):
         # verify fetch can be performed
         self._verifyFetch(space)
@@ -811,6 +826,7 @@
 
         # fetch as many rows as possible
         while limit is None or rowNum < limit:
+            rowNum += 1
             if not self._moreRows(space):
                 break
             w_row = self._createRow(space)
@@ -943,7 +959,7 @@
             numElements = space.int_w(w_value)
         else:
             raise OperationError(
-                w_NotSupportedErrorException,
+                get(space).w_NotSupportedErrorException,
                 space.wrap("expecting integer or list of values"))
 
         # create the variable
@@ -974,7 +990,7 @@
         self.bindList = None
         self.bindDict = None
 
-        self.setInputSizes = 1
+        self.setInputSizes = True
 
         # process each input
         if kw_w:
@@ -996,21 +1012,30 @@
             return space.newlist(self.bindList)
     setinputsizes.unwrap_spec = ['self', ObjSpace, Arguments]
 
-def cursor_arraysize_get(space, obj):
-    return space.wrap(obj.arraySize)
-def cursor_arraysize_set(space, obj, w_value):
-    obj.arraySize = space.int_w(w_value)
-
-def cursor_bindarraysize_get(space, obj):
-    return space.wrap(obj.bindArraySize)
-def cursor_bindarraysize_set(space, obj, w_value):
-    obj.bindArraySize = space.int_w(w_value)
-
-def cursor_bindvars_get(space, obj):
-    if obj.bindList:
-        return space.newlist(obj.bindList)
-    if obj.bindDict:
-        return obj.bindDict
+    def setoutputsize(self, space, outputSize, outputSizeColumn=-1):
+        self.outputSize = outputSize
+        self.outputSizeColumn = outputSizeColumn
+    setoutputsize.unwrap_spec = ['self', ObjSpace, int, int]
+
+
+    def arraysize_get(space, self):
+        return space.wrap(self.arraySize)
+    def arraysize_set(space, self, w_value):
+        self.arraySize = space.int_w(w_value)
+
+    def bindarraysize_get(space, self):
+        return space.wrap(self.bindArraySize)
+    def bindarraysize_set(space, self, w_value):
+        self.bindArraySize = space.int_w(w_value)
+
+    def bindvars_get(space, self):
+        if self.bindList:
+            return space.newlist(self.bindList)
+        if self.bindDict:
+            return self.bindDict
+
+    def fetchvars_get(space, self):
+        return space.newlist(self.fetchVariables)
 
 W_Cursor.typedef = TypeDef(
     'Cursor',
@@ -1022,6 +1047,8 @@
                          unwrap_spec=W_Cursor.prepare.unwrap_spec),
     fetchone = interp2app(W_Cursor.fetchone,
                          unwrap_spec=W_Cursor.fetchone.unwrap_spec),
+    fetchmany = interp2app(W_Cursor.fetchmany,
+                         unwrap_spec=W_Cursor.fetchmany.unwrap_spec),
     fetchall = interp2app(W_Cursor.fetchall,
                          unwrap_spec=W_Cursor.fetchall.unwrap_spec),
     close = interp2app(W_Cursor.close,
@@ -1038,14 +1065,19 @@
                           unwrap_spec=W_Cursor.arrayvar.unwrap_spec),
     setinputsizes = interp2app(W_Cursor.setinputsizes,
                                unwrap_spec=W_Cursor.setinputsizes.unwrap_spec),
+    setoutputsize = interp2app(W_Cursor.setoutputsize,
+                               unwrap_spec=W_Cursor.setoutputsize.unwrap_spec),
 
     __iter__ = interp2app(W_Cursor.descr_iter),
     next = interp2app(W_Cursor.descr_next),
 
-    arraysize = GetSetProperty(cursor_arraysize_get, cursor_arraysize_set),
-    bindarraysize = GetSetProperty(cursor_bindarraysize_get, cursor_bindarraysize_set),
+    arraysize = GetSetProperty(W_Cursor.arraysize_get,
+                               W_Cursor.arraysize_set),
+    bindarraysize = GetSetProperty(W_Cursor.bindarraysize_get,
+                                   W_Cursor.bindarraysize_set),
     rowcount = interp_attrproperty('rowCount', W_Cursor),
     statement = interp_attrproperty_w('w_statement', W_Cursor),
-    bindvars = GetSetProperty(cursor_bindvars_get),
+    bindvars = GetSetProperty(W_Cursor.bindvars_get),
+    fetchvars = GetSetProperty(W_Cursor.fetchvars_get),
     description = GetSetProperty(W_Cursor.getDescription),
 )

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/interp_error.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/interp_error.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/interp_error.py	Fri Nov 20 21:35:04 2009
@@ -25,6 +25,7 @@
         w_datetime = space.call(w_import, space.newlist(
             [space.wrap('datetime')]))
         self.w_DateTimeType = space.getattr(w_datetime, space.wrap("datetime"))
+        self.w_DateType = space.getattr(w_datetime, space.wrap("date"))
 
 
 def get(space): 

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/interp_variable.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/interp_variable.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/interp_variable.py	Fri Nov 20 21:35:04 2009
@@ -144,12 +144,12 @@
                 self.size = size
 
         # allocate the data for the variable
-        self.allocateData()
+        self.allocateData(self.environment.space)
     
         # allocate the indicator for the variable
         self.indicator = lltype.malloc(rffi.CArrayPtr(roci.sb2).TO,
                                        self.allocatedElements,
-                                       flavor='raw', zero=True) # XXX
+                                       flavor='raw', zero=True)
 
         # ensure that all variable values start out NULL
         for i in range(self.allocatedElements):
@@ -159,7 +159,7 @@
         if self.isVariableLength:
             self.returnCode = lltype.malloc(rffi.CArrayPtr(roci.ub2).TO,
                                             self.allocatedElements,
-                                            flavor='raw', zero=True) # XXX
+                                            flavor='raw', zero=True)
 
         # perform extended initialization
         self.initialize(cursor)
@@ -170,28 +170,33 @@
             lltype.free(self.actualLength, flavor='raw')
         if self.data:
             lltype.free(self.data, flavor='raw')
+        if self.returnCode:
+            lltype.free(self.returnCode, flavor='raw')
 
     def getBufferSize(self):
         return self.size
 
-    def allocateData(self):
+    def allocateData(self, space):
         # set the buffer size for the variable
         self.bufferSize = self.getBufferSize()
 
         # allocate the data as long as it is small enough
-        dataLength = ovfcheck(self.allocatedElements * self.bufferSize)
-        if dataLength > sys.maxint:
-            raise ValueError("array size too large")
+        try:
+            dataLength = ovfcheck(self.allocatedElements * self.bufferSize)
+        except OverflowError:
+            raise OperationError(
+                space.w_ValueError,
+                space.wrap("array size too large"))
 
         self.data = lltype.malloc(rffi.CCHARP.TO, int(dataLength),
                                   flavor='raw', zero=True)
 
-    def resize(self, size):
+    def resize(self, space, size):
         # allocate the data for the new array
         orig_data = self.data
         orig_size = self.bufferSize
         self.size = size
-        self.allocateData()
+        self.allocateData(space)
 
         # copy the data from the original array to the new array
         for i in range(self.allocatedElements):
@@ -290,13 +295,13 @@
                 error = W_Error(space, self.environment,
                                 "Variable_VerifyFetch()", 0)
                 error.code = self.returnCode[pos]
-                error.message = self.space.wrap(
+                error.message = space.wrap(
                     "column at array pos %d fetched with error: %d" %
                     (pos, self.returnCode[pos]))
-                w_error = get(self.space).w_DatabaseError
+                w_error = get(space).w_DatabaseError
 
-                raise OperationError(get(self.space).w_DatabaseError,
-                                     self.space.wrap(error))
+                raise OperationError(get(space).w_DatabaseError,
+                                     space.wrap(error))
 
     def getSingleValue(self, space, pos):
         # ensure we do not exceed the number of allocated elements
@@ -356,7 +361,7 @@
                 space.w_TypeError,
                 space.wrap("expecting array data"))
 
-        elements_w = space.viewiterable(w_value)
+        elements_w = space.listview(w_value)
 
         # ensure we haven't exceeded the number of allocated elements
         if len(elements_w) > self.allocatedElements:
@@ -384,8 +389,9 @@
     setvalue = interp2app(W_Variable.setValue,
                           unwrap_spec=W_Variable.setValue.unwrap_spec),
 
-    maxlength = interp_attrproperty('bufferSize', W_Variable),
-
+    maxlength  = interp_attrproperty('bufferSize', W_Variable),
+    bufferSize = interp_attrproperty('bufferSize', W_Variable),
+    size = interp_attrproperty('size', W_Variable),
     )
 
 class VT_String(W_Variable):
@@ -462,7 +468,7 @@
 
             # ensure that the buffer is large enough
             if buf.size > self.bufferSize:
-                self.resize(size)
+                self.resize(space, size)
 
             # keep a copy of the string
             self.actualLength[pos] = rffi.cast(roci.ub2, buf.size)
@@ -480,7 +486,36 @@
     pass
 
 class VT_LongString(W_Variable):
-    pass
+    oracleType = roci.SQLT_LVC
+    isVariableLength = True
+    size = 128 * 1024
+
+    def getBufferSize(self):
+        return self.size + rffi.sizeof(roci.ub4)
+
+    def getValueProc(self, space, pos):
+        ptr = rffi.ptradd(self.data, pos * self.bufferSize)
+        length = rffi.cast(roci.Ptr(roci.ub4), ptr)[0]
+
+        ptr = rffi.ptradd(ptr, rffi.sizeof(roci.ub4))
+        return space.wrap(rffi.charpsize2str(ptr, length))
+
+    def setValueProc(self, space, pos, w_value):
+        buf = config.StringBuffer()
+        buf.fill(space, w_value)
+
+        try:
+            # ensure that the buffer is large enough
+            if buf.size + rffi.sizeof(roci.ub4) > self.bufferSize:
+                self.resize(space, buf.size + rffi.sizeof(roci.ub4))
+
+            # copy the string to the Oracle buffer
+            ptr = rffi.ptradd(self.data, pos * self.bufferSize)
+            rffi.cast(roci.Ptr(roci.ub4), ptr)[0] = rffi.cast(roci.ub4, buf.size)
+            for index in range(buf.size):
+                ptr[index + rffi.sizeof(roci.ub4)] = buf.ptr[index]
+        finally:
+            buf.clear()
 
 class VT_FixedNationalChar(W_Variable):
     pass
@@ -490,11 +525,12 @@
     size = 18
     isVariableLength = False
 
-class VT_Binary(W_Variable):
-    pass
+class VT_Binary(VT_String):
+    oracleType = roci.SQLT_BIN
+    size = config.MAX_BINARY_BYTES
 
-class VT_LongBinary(W_Variable):
-    pass
+class VT_LongBinary(VT_LongString):
+    oracleType = roci.SQLT_LVB
 
 class VT_NativeFloat(W_Variable):
     pass
@@ -542,9 +578,10 @@
                 lltype.free(attrptr, flavor='raw')
 
             if scale == 0 or (scale == -127 and precision == 0):
-                return VT_LongInteger
-            elif precision > 0 and precision < 10:
-                return VT_Integer
+                if precision > 0 and precision < 10:
+                    return VT_Integer
+                else:
+                    return VT_LongInteger
 
         return cls
 
@@ -592,8 +629,13 @@
                                          rffi.cast(lltype.Signed, sizeptr[0])))
                 if isinstance(self, VT_NumberAsString):
                     return w_strvalue
-                else:
+
+                try:
                     return space.call_function(space.w_int, w_strvalue)
+                except OperationError, e:
+                    if e.match(space, space.w_ValueError):
+                        return space.call_function(space.w_float, w_strvalue)
+                    raise
             finally:
                 rffi.keep_buffer_alive_until_here(textbuf, text)
                 lltype.free(sizeptr, flavor='raw')
@@ -693,7 +735,6 @@
         dataptr = rffi.ptradd(
             rffi.cast(roci.Ptr(roci.OCIDate), self.data),
             pos)
-        dataptr = rffi.cast(roci.Ptr(roci.OCIDate), self.data)
         return transform.OracleDateToPythonDateTime(self.environment, dataptr)
 
     def setValueProc(self, space, pos, w_value):
@@ -708,14 +749,18 @@
             minute = space.int_w(space.getattr(w_value, space.wrap('minute')))
             second = space.int_w(space.getattr(w_value, space.wrap('second')))
         elif space.is_true(space.isinstance(w_value, get(space).w_DateType)):
-            XXX
+            year = space.int_w(space.getattr(w_value, space.wrap('year')))
+            month = space.int_w(space.getattr(w_value, space.wrap('month')))
+            day = space.int_w(space.getattr(w_value, space.wrap('day')))
+            hour = minute = second = 0
         else:
             raise OperationError(
                 space.w_TypeError,
                 space.wrap("expecting date data"))
 
         # store a copy of the value
-        timePart = dataptr[0].c_OCIDateTime
+        value = dataptr[0]
+        timePart = value.c_OCIDateTime
         rffi.setintfield(timePart, 'c_OCITimeHH', hour)
         rffi.setintfield(timePart, 'c_OCITimeMI', minute)
         rffi.setintfield(timePart, 'c_OCITimeSS', second)
@@ -723,7 +768,7 @@
         rffi.setintfield(dataptr[0], 'c_OCIDateMM', month)
         rffi.setintfield(dataptr[0], 'c_OCIDateDD', day)
 
-class VT_Date(W_Variable):
+class VT_Date(VT_DateTime):
     oracleType = roci.SQLT_ODT
     size = rffi.sizeof(roci.OCIDate)
 
@@ -869,7 +914,10 @@
 
     if space.is_true(space.isinstance(w_value, space.w_str)):
         size = space.int_w(space.len(w_value))
-        return VT_String, size, numElements
+        if size > config.MAX_STRING_CHARS:
+            return VT_LongString, size, numElements
+        else:
+            return VT_String, size, numElements
 
     # XXX Unicode
 
@@ -889,7 +937,8 @@
     if space.is_true(space.isinstance(w_value, get(space).w_DateTimeType)):
         return VT_DateTime, 0, numElements
 
-    # XXX date
+    if space.is_true(space.isinstance(w_value, get(space).w_DateType)):
+        return VT_Date, 0, numElements
 
     # XXX Delta
 
@@ -900,7 +949,7 @@
 
     # handle arrays
     if space.is_true(space.isinstance(w_value, space.w_list)):
-        elements_w = space.viewiterable(w_value)
+        elements_w = space.listview(w_value)
         for w_element in elements_w:
             if not space.is_w(w_element, space.w_None):
                 break
@@ -933,7 +982,7 @@
 def newArrayVariableByType(space, cursor, w_value):
     "Allocate a new PL/SQL array by looking at the Python data type."
 
-    w_type, w_numElements = space.viewiterable(w_value, 2)
+    w_type, w_numElements = space.fixedview(w_value, 2)
 
     numElements = space.int_w(w_numElements)
     varType = typeByPythonType(space, cursor, w_type)
@@ -963,4 +1012,4 @@
 
     # everything else ought to be a Python type
     varType = typeByPythonType(space, cursor, w_value)
-    return varType(cursor, numElements)
+    return varType(cursor, numElements, varType.size)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/roci.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/roci.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/roci.py	Fri Nov 20 21:35:04 2009
@@ -30,7 +30,7 @@
     ub4 = platform.SimpleType('ub4', rffi.UINT)
     sb4 = platform.SimpleType('sb4', rffi.INT)
     sword = platform.SimpleType('sword', rffi.INT)
-    uword = platform.SimpleType('sword', rffi.UINT)
+    uword = platform.SimpleType('uword', rffi.UINT)
 
     OCINumber = platform.Struct('OCINumber', [])
     OCITime   = platform.Struct('OCITime',
@@ -49,26 +49,28 @@
     OCI_DEFAULT OCI_OBJECT OCI_THREADED OCI_EVENTS
     OCI_SUCCESS OCI_SUCCESS_WITH_INFO OCI_INVALID_HANDLE OCI_NO_DATA
     OCI_HTYPE_ERROR OCI_HTYPE_SVCCTX OCI_HTYPE_SERVER OCI_HTYPE_SESSION
-    OCI_HTYPE_STMT OCI_HTYPE_DESCRIBE
+    OCI_HTYPE_STMT OCI_HTYPE_DESCRIBE OCI_HTYPE_ENV
     OCI_DTYPE_PARAM
-    OCI_CRED_RDBMS
+    OCI_CRED_RDBMS OCI_CRED_EXT OCI_SPOOL_ATTRVAL_NOWAIT
     OCI_ATTR_SERVER OCI_ATTR_SESSION OCI_ATTR_USERNAME OCI_ATTR_PASSWORD
     OCI_ATTR_STMT_TYPE OCI_ATTR_PARAM_COUNT OCI_ATTR_ROW_COUNT
     OCI_ATTR_NAME OCI_ATTR_SCALE OCI_ATTR_PRECISION OCI_ATTR_IS_NULL
     OCI_ATTR_DATA_SIZE OCI_ATTR_DATA_TYPE OCI_ATTR_CHARSET_FORM
+    OCI_ATTR_ENV_CHARSET_ID
     OCI_ATTR_PARSE_ERROR_OFFSET
     OCI_NTV_SYNTAX
     OCI_FETCH_NEXT
     OCI_IND_NULL OCI_IND_NOTNULL
     OCI_STMT_SELECT OCI_STMT_CREATE OCI_STMT_DROP OCI_STMT_ALTER
     OCI_STMT_INSERT OCI_STMT_DELETE OCI_STMT_UPDATE
-    SQLT_CHR SQLT_LNG SQLT_AFC SQLT_RDD SQLT_BIN SQLT_LBI
+    SQLT_CHR SQLT_LNG SQLT_AFC SQLT_RDD SQLT_BIN SQLT_LBI SQLT_LVC SQLT_LVB
     SQLT_BFLOAT SQLT_IBFLOAT SQLT_BDOUBLE SQLT_IBDOUBLE
     SQLT_NUM SQLT_VNU SQLT_DAT SQLT_ODT SQLT_DATE SQLT_TIMESTAMP
     SQLT_TIMESTAMP_TZ SQLT_TIMESTAMP_LTZ SQLT_INTERVAL_DS
     SQLT_CLOB SQLT_CLOB SQLT_BLOB SQLT_BFILE SQLT_RSET SQLT_NTY
     SQLCS_IMPLICIT SQLCS_NCHAR
     OCI_NUMBER_SIGNED
+    OCI_NLS_MAXBUFSZ OCI_NLS_CS_ORA_TO_IANA
     '''.split()
 
     for c in constants:
@@ -394,3 +396,21 @@
      oratext],         # buf
     sword)
 
+# OCI Locale Functions
+
+OCINlsCharSetIdToName = external(
+    'OCINlsCharSetIdToName',
+    [dvoidp,           # hndl
+     oratext,          # buf
+     size_t,           # buflen
+     ub2],             # id
+    sword)
+
+OCINlsNameMap = external(
+    'OCINlsNameMap',
+    [dvoidp,           # hndl
+     oratext,          # buf
+     size_t,           # buflen
+     oratext,          # srcbuf
+     uword],           # flag
+    sword)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_connect.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_connect.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_connect.py	Fri Nov 20 21:35:04 2009
@@ -105,4 +105,14 @@
         count, = cursor.fetchone()
         assert count == 0
 
+    def test_charset(self):
+        self.cnx = oracle.connect(self.username, self.password,
+                                  self.tnsentry)
+        encoding = self.cnx.encoding
+        assert isinstance(encoding, str)
+        assert encoding != ""
+        encoding = self.cnx.nationalencoding
+        assert isinstance(encoding, str)
+        assert encoding != ""
+
 

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_cursor.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_cursor.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_cursor.py	Fri Nov 20 21:35:04 2009
@@ -174,3 +174,8 @@
             ('NULLABLECOL', oracle.NUMBER, 39, 22, 38, 0, 1),
             ]
         assert got == expected
+
+    def test_outputsize(self):
+        cur = self.cnx.cursor()
+        cur.setoutputsize(25000)
+        cur.setoutputsize(25000, 2)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_datetimevar.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_datetimevar.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_datetimevar.py	Fri Nov 20 21:35:04 2009
@@ -2,7 +2,7 @@
 
 class AppTestDatetime(OracleTestBase):
 
-    def test_bind_date(self):
+    def test_bind_datetime(self):
         import datetime
         cur = self.cnx.cursor()
         cur.execute("select to_char(:d, 'YYYYMMDD-HH24MISS') from dual",
@@ -10,3 +10,31 @@
         data = cur.fetchall()
         assert data == [('20021213-093615',)]
 
+    def test_bind_date(self):
+        import datetime
+        cur = self.cnx.cursor()
+        cur.execute("select to_char(:d, 'YYYYMMDD-HH24MISS') from dual",
+                    d=oracle.Date(2002, 12, 13))
+        data = cur.fetchall()
+        assert data == [('20021213-000000',)]
+
+    def test_variable(self):
+        import datetime
+        cur = self.cnx.cursor()
+        var = cur.var(oracle.DATETIME)
+        value = datetime.datetime(2002, 12, 13, 9, 36, 15)
+        var.setvalue(0, value)
+        assert var.getvalue() == value
+
+        value = datetime.date(2002, 12, 13)
+        var.setvalue(0, value)
+        assert var.getvalue() == datetime.datetime(2002, 12, 13)
+
+    def test_arrayvar(self):
+        import datetime
+        cur = self.cnx.cursor()
+        var = cur.arrayvar(oracle.DATETIME, 2)
+        values = [datetime.datetime(2002, 12, 13, 9, 36, 15),
+                  datetime.datetime(2003,  7, 22, 4, 24, 32)]
+        var.setvalue(0, values)
+        assert var.getvalue() == values

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_numbervar.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_numbervar.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_numbervar.py	Fri Nov 20 21:35:04 2009
@@ -2,6 +2,12 @@
 
 class AppTestNumberVar(OracleTestBase):
 
+    def test_fetch(self):
+        cur = self.cnx.cursor()
+        cur.execute("select 1.5 from dual")
+        value, = cur.fetchone()
+        assert value == 1.5
+
     def test_float(self):
         cur = self.cnx.cursor()
         var = cur.var(oracle.NUMBER)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_select.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_select.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_select.py	Fri Nov 20 21:35:04 2009
@@ -6,10 +6,13 @@
         cur = self.cnx.cursor()
         cur.execute("select 42, 'Hello' from dual")
         row = cur.fetchone()
-        assert isinstance(row[0], float)
+        assert isinstance(row[0], int)
         assert isinstance(row[1], str)
         assert row == (42, 'Hello')
 
+        assert isinstance(cur.fetchvars[0], oracle.Variable)
+        assert isinstance(cur.fetchvars[1], oracle.Variable)
+
     def test_sysdate(self):
         import datetime
         cur = self.cnx.cursor()
@@ -19,7 +22,7 @@
         assert isinstance(sysdate, datetime.datetime)
         delta = abs(sysdate - datetime.datetime.now())
         assert delta < datetime.timedelta(seconds=2)
-        
+
     def test_fetchall(self):
         cur = self.cnx.cursor()
         # An Oracle trick to retrieve 42 lines
@@ -28,12 +31,25 @@
         assert rows == zip(range(42))
         assert cur.rowcount == 42
 
+    def test_fetchmany(self):
+        cur = self.cnx.cursor()
+        cur.execute("select level-1 from dual connect by level-1<442")
+        rows = cur.fetchmany()
+        assert rows == zip(range(cur.arraysize))
+        rows = cur.fetchmany(3)
+        assert rows == zip(range(cur.arraysize, cur.arraysize+3))
+        assert cur.rowcount == cur.arraysize+3
+
     def test_iterator(self):
         cur = self.cnx.cursor()
-        # An Oracle trick to retrieve 42 lines
         cur.execute("select level-1 from dual connect by level-1<42")
         for i, row in enumerate(cur):
             assert row == (i,)
         assert i == 41
 
-        
+    def test_arraysize_too_large(self):
+        cur = self.cnx.cursor()
+        cur.arraysize = 2 ** 20
+        largevar = cur.var(oracle.STRING)
+        raises(ValueError,
+               cur.execute, "select :large from dual", large=largevar)

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_stringvar.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_stringvar.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/test/test_stringvar.py	Fri Nov 20 21:35:04 2009
@@ -2,9 +2,18 @@
 
 class AppTestStringVar(OracleTestBase):
 
+    def test_bind_inout(self):
+        cur = self.cnx.cursor()
+        vars = cur.setinputsizes(value=oracle.STRING)
+        cur.execute("""
+            begin
+              :value := :value || ' output';
+            end;""",
+            value="input")
+        assert vars["value"].getvalue() == "input output"
+
     def test_rowid(self):
         cur = self.cnx.cursor()
-        var = cur.var(oracle.NUMBER)
         cur.execute("select rowid from dual")
         rowid, = cur.fetchone()
         cur.execute("select * from dual where rowid = :r",
@@ -92,3 +101,32 @@
         assert tablelen.getvalue() == 20
         # dbms_utility.comma_to_table returns a 'NULL-terminated' table
         assert arrayvar.getvalue() == array + [None]
+
+    def test_binary(self):
+        cur = self.cnx.cursor()
+        try:
+            cur.execute("drop table pypy_temp_table")
+        except oracle.DatabaseError:
+            pass
+        cur.execute("create table pypy_temp_table (rawcol raw(30))")
+
+        cur.setinputsizes(p=oracle.BINARY)
+        cur.execute("insert into pypy_temp_table values (:p)",
+                    p="raw string")
+        cur.execute("select * from pypy_temp_table")
+        data = cur.fetchall()
+        assert data == [("raw string",)]
+
+    def test_longstring(self):
+        cur = self.cnx.cursor()
+        output = cur.var(oracle.LONG_STRING)
+        cur.execute("""
+            declare
+              t_Temp varchar2(10000);
+            begin
+              t_Temp := :bigString;
+              :output := t_Temp;
+            end;""",
+            bigString="X" * 10000, output=output)
+        assert output.getvalue() == "X" * 10000
+

Modified: pypy/branch/shorter-guard-path/pypy/module/oracle/transform.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/oracle/transform.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/oracle/transform.py	Fri Nov 20 21:35:04 2009
@@ -63,12 +63,12 @@
     w_tuple_value = space.call_method(w_value, "as_tuple")
 
     # acquire basic information from the value tuple
-    w_sign, w_digits, w_scale = space.viewiterable(w_tuple_value)
+    w_sign, w_digits, w_scale = space.fixedview(w_tuple_value, 3)
 
     text = ''
     format = ''
 
-    digits_w = space.viewiterable(w_digits)
+    digits_w = space.listview(w_digits)
     num_digits = len(digits_w)
     scale = space.int_w(w_scale)
 

Modified: pypy/branch/shorter-guard-path/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/posix/interp_posix.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/posix/interp_posix.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/rctime/interp_time.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/rctime/interp_time.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/rctime/interp_time.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/module/select/interp_select.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/module/select/interp_select.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/module/select/interp_select.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/flow/objspace.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/flow/objspace.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/dictmultiobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/dictmultiobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/dictmultiobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/floatobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/floatobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/floatobject.py	Fri Nov 20 21:35:04 2009
@@ -2,7 +2,7 @@
 from pypy.interpreter import gateway
 from pypy.objspace.std.noneobject import W_NoneObject
 from pypy.objspace.std.longobject import W_LongObject
-from pypy.rlib.rarithmetic import ovfcheck_float_to_int, intmask, isinf
+from pypy.rlib.rarithmetic import ovfcheck_float_to_int, intmask, isinf, isnan
 from pypy.rlib.rarithmetic import formatd
 
 import math
@@ -197,6 +197,9 @@
 def _hash_float(space, v):
     from pypy.objspace.std.longobject import hash__Long
 
+    if isnan(v):
+        return 0
+
     # This is designed so that Python numbers of different types
     # that compare equal hash to the same value; otherwise comparisons
     # of mapping keys will turn out weird.

Modified: pypy/branch/shorter-guard-path/pypy/objspace/std/formatting.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/formatting.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/formatting.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/inlinedict.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/inlinedict.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/inlinedict.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/listobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/listobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/listobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/marshal_impl.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/marshal_impl.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/marshal_impl.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/objspace.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/objspace.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/objspace.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/ropeobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/ropeobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/ropeobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/ropeunicodeobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/ropeunicodeobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/ropeunicodeobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/setobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/setobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/setobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/stringobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/stringobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/stringobject.py	Fri Nov 20 21:35:04 2009
@@ -349,13 +349,13 @@
                                                        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
         listlen = 0
         reslen = 0
-        l = []
+        l = [None] * len(list_w)
         for i in range(len(list_w)):
             w_s = list_w[i]
             if not space.is_true(space.isinstance(w_s, space.w_str)):
@@ -367,7 +367,7 @@
                     space.wrap("sequence item %d: expected string, %s "
                                "found" % (i,
                                           space.type(w_s).getname(space, '?'))))
-            l.append(space.str_w(w_s))
+            l[i] = space.str_w(w_s)
         return space.wrap(self.join(l))
     else:
         return W_StringObject.EMPTY
@@ -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/branch/shorter-guard-path/pypy/objspace/std/strsliceobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/strsliceobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/strsliceobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/test/test_celldict.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_celldict.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_celldict.py	Fri Nov 20 21:35:04 2009
@@ -1,4 +1,5 @@
-from pypy.conftest import gettestobjspace
+import py
+from pypy.conftest import gettestobjspace, option
 from pypy.objspace.std.celldict import get_global_cache, ModuleCell, ModuleDictImplementation
 from pypy.interpreter import gateway
 
@@ -8,6 +9,8 @@
 
 class AppTestCellDict(object):
     def setup_class(cls):
+        if option.runappdirect:
+            py.test.skip("not appdirect tests")
         cls.space = gettestobjspace(**{"objspace.std.withcelldict": True})
         cls.w_impl_used = cls.space.appexec([], """():
             import __pypy__

Modified: pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_dictmultiobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_dictmultiobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_dictmultiobject.py	Fri Nov 20 21:35:04 2009
@@ -607,8 +607,8 @@
     StringObjectCls = FakeString
     w_dict = None
     iter = iter
-    viewiterable = list
-
+    fixedview = list
+    listview  = list
 
 class Config:
     class objspace:

Modified: pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_floatobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_floatobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_floatobject.py	Fri Nov 20 21:35:04 2009
@@ -59,10 +59,7 @@
         inf = 1e200 * 1e200
         assert hash(inf) == 314159
         assert hash(-inf) == -271828
-        x = hash(inf/inf)
-        # ^^^ assert did not crash, even though the result is a bit random
-        #     e.g. it appears to be -32768 on Win32 and 0 on Linux
-        assert x == hash(inf/inf)
+        assert hash(inf/inf) == 0
 
     def test_int_float(self):
         assert int(42.1234) == 42

Modified: pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_userobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_userobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/test/test_userobject.py	Fri Nov 20 21:35:04 2009
@@ -1,3 +1,4 @@
+import py
 from pypy.interpreter import gateway
 
 
@@ -283,6 +284,8 @@
 
         cls.prev_installer = multimethod.Installer
         multimethod.Installer = multimethod.InstallerVersion2
+        if conftest.option.runappdirect:
+            py.test.skip("Cannot run different installers when runappdirect")
         config = conftest.make_config(conftest.option, **cls.OPTIONS)
         cls.space = conftest.maketestobjspace(config)
 

Modified: pypy/branch/shorter-guard-path/pypy/objspace/std/tupletype.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/tupletype.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/tupletype.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/typeobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/typeobject.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/typetype.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/typetype.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/typetype.py	Fri Nov 20 21:35:04 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/branch/shorter-guard-path/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/objspace/std/unicodeobject.py	Fri Nov 20 21:35:04 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:
@@ -182,7 +182,7 @@
         space.is_w(space.type(l[0]), space.w_unicode)):
         return l[0]
     
-    values_list = []
+    values_list = [None] * len(l)
     for i in range(len(l)):
         item = l[i]
         if isinstance(item, W_UnicodeObject):
@@ -194,7 +194,7 @@
             w_msg = space.mod(space.wrap('sequence item %d: expected string or Unicode'),
                               space.wrap(i))
             raise OperationError(space.w_TypeError, w_msg)
-        values_list.append(item)
+        values_list[i] = item
     return W_UnicodeObject(w_self._value.join(values_list))
 
 def hash__Unicode(space, w_uni):
@@ -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/branch/shorter-guard-path/pypy/rpython/callparse.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/rpython/callparse.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/rpython/callparse.py	Fri Nov 20 21:35:04 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

Modified: pypy/branch/shorter-guard-path/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/branch/shorter-guard-path/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/branch/shorter-guard-path/pypy/translator/c/gcc/trackgcroot.py	Fri Nov 20 21:35:04 2009
@@ -754,7 +754,8 @@
         '_exit': None,
         '__assert_fail': None,
         '___assert_rtn': None,
-        'L___assert_rtn$stub': None
+        'L___assert_rtn$stub': None,
+        'L___eprintf$stub': None,
         }
 
     def __init__(self, lines, filetag=0):



More information about the Pypy-commit mailing list