[pypy-svn] r76201 - in pypy/branch/interplevel-array/pypy/module/array: . test

hakanardo at codespeak.net hakanardo at codespeak.net
Wed Jul 14 15:42:57 CEST 2010


Author: hakanardo
Date: Wed Jul 14 15:42:55 2010
New Revision: 76201

Modified:
   pypy/branch/interplevel-array/pypy/module/array/interp_array.py
   pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
Log:
compiling

Modified: pypy/branch/interplevel-array/pypy/module/array/interp_array.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/array/interp_array.py	(original)
+++ pypy/branch/interplevel-array/pypy/module/array/interp_array.py	Wed Jul 14 15:42:55 2010
@@ -602,9 +602,11 @@
 
     def descr_reduce(self):
         space=self.space
-        args=[space.wrap(self._array.typecode)]
-        if self._array.len>0:
-            args += [self._array.descr_tostring()]
+        if space.int_w(space.len(self._array)) > 0:
+            w_s = space.call_function(space.getattr(self._array, space.wrap('tostring')))
+            args = [space.wrap(self._array.typecode), w_s]
+        else:
+            args = [space.wrap(self._array.typecode)]
         return space.newtuple([space.type(self), space.newtuple(args)])
         
 

Modified: pypy/branch/interplevel-array/pypy/module/array/test/test_array.py
==============================================================================
--- pypy/branch/interplevel-array/pypy/module/array/test/test_array.py	(original)
+++ pypy/branch/interplevel-array/pypy/module/array/test/test_array.py	Wed Jul 14 15:42:55 2010
@@ -497,10 +497,14 @@
         assert a == b
 
         a = self.array('l')
-        s = pickle.dumps(a,1)
+        s = pickle.dumps(a, 1)
         b = pickle.loads(s)
         assert len(b) == 0 and b.typecode == 'l'
 
+        a = self.array('i', [1, 2, 4])
+        i = iter(a)
+        raises(TypeError, pickle.dumps, i, 1)
+
     def test_copy_swap(self):
         a = self.array('i', [1, 2, 3])
         from copy import copy



More information about the Pypy-commit mailing list