[pypy-svn] r9765 - pypy/dist/pypy/interpreter

pedronis at codespeak.net pedronis at codespeak.net
Mon Mar 14 16:52:54 CET 2005


Author: pedronis
Date: Mon Mar 14 16:52:54 2005
New Revision: 9765

Modified:
   pypy/dist/pypy/interpreter/baseobjspace.py
Log:
don't mix int values and None



Modified: pypy/dist/pypy/interpreter/baseobjspace.py
==============================================================================
--- pypy/dist/pypy/interpreter/baseobjspace.py	(original)
+++ pypy/dist/pypy/interpreter/baseobjspace.py	Mon Mar 14 16:52:54 2005
@@ -138,7 +138,7 @@
             return w_obj
         return None
 
-    def unpackiterable(self, w_iterable, expected_length=None):
+    def unpackiterable(self, w_iterable, expected_length=-1):
         """Unpack an iterable object into a real (interpreter-level) list.
         Raise a real ValueError if the length is wrong."""
         w_iterator = self.iter(w_iterable)
@@ -150,10 +150,10 @@
                 if not e.match(self, self.w_StopIteration):
                     raise
                 break  # done
-            if expected_length is not None and len(items) == expected_length:
+            if expected_length != -1 and len(items) == expected_length:
                 raise ValueError, "too many values to unpack"
             items.append(w_item)
-        if expected_length is not None and len(items) < expected_length:
+        if expected_length != -1 and len(items) < expected_length:
             i = len(items)
             if i == 1:
                 plural = ""



More information about the Pypy-commit mailing list