Author: Brian Kearns <bdkea...@gmail.com>
Branch: 
Changeset: r67457:09b36515b085
Date: 2013-10-17 04:04 -0400
http://bitbucket.org/pypy/pypy/changeset/09b36515b085/

Log:    fix __reduce__() order for record arrays

diff --git a/pypy/module/micronumpy/interp_dtype.py 
b/pypy/module/micronumpy/interp_dtype.py
--- a/pypy/module/micronumpy/interp_dtype.py
+++ b/pypy/module/micronumpy/interp_dtype.py
@@ -259,21 +259,22 @@
         builder_args = space.newtuple([space.wrap("%s%d" % (kind, elemsize)), 
space.wrap(0), space.wrap(1)])
 
         version = space.wrap(3)
-        order = space.wrap(byteorder_prefix if self.native else 
nonnative_byteorder_prefix)
         names = self.descr_get_names(space)
         values = self.descr_get_fields(space)
         if self.fields:
+            order = space.wrap('|')
             #TODO: Implement this when subarrays are implemented
             subdescr = space.w_None
-            #TODO: Change this when alignment is implemented :
             size = 0
             for key in self.fields:
                 dtype = self.fields[key][1]
                 assert isinstance(dtype, W_Dtype)
                 size += dtype.get_size()
             w_size = space.wrap(size)
+            #TODO: Change this when alignment is implemented
             alignment = space.wrap(1)
         else:
+            order = space.wrap(byteorder_prefix if self.native else 
nonnative_byteorder_prefix)
             subdescr = space.w_None
             w_size = space.wrap(-1)
             alignment = space.wrap(-1)
diff --git a/pypy/module/micronumpy/test/test_dtypes.py 
b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -885,7 +885,7 @@
         from cPickle import loads, dumps
 
         d = dtype([("x", "int32"), ("y", "int32"), ("z", "int32"), ("value", 
float)])
-        assert d.__reduce__() == (dtype, ('V20', 0, 1), (3, '<', None, ('x', 
'y', 'z', 'value'), {'y': (dtype('int32'), 4), 'x': (dtype('int32'), 0), 'z': 
(dtype('int32'), 8), 'value': (dtype('float64'), 12)}, 20, 1, 0))
+        assert d.__reduce__() == (dtype, ('V20', 0, 1), (3, '|', None, ('x', 
'y', 'z', 'value'), {'y': (dtype('int32'), 4), 'x': (dtype('int32'), 0), 'z': 
(dtype('int32'), 8), 'value': (dtype('float64'), 12)}, 20, 1, 0))
 
         new_d = loads(dumps(d))
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to