[SciPy-dev] Check reading the nested fields of a nested array

Travis Oliphant oliphant.travis at ieee.org
Tue Apr 25 11:10:08 CDT 2006

Stefan van der Walt wrote:
> Hi,
> My message below wasn't very helpful, mainly due to my inability to
> use valgrind properly.  With some help from Albert, I think I narrowed
> down the problem.
> The following writes at an invalid memory location:
> from numpy import *
> ulen = 1
> ucs_value = u'\U0010FFFF'
> ua = array([[[ucs_value*ulen]*2]*3]*4,
>            dtype='U%s' % ulen)
> ua2 = ua.newbyteorder()

Thank you very, very much for this very helpful demonstration.  It 
allowed me to quickly isolate the problem which was indeed a 
memory-access violation due to forgetting to divide the itemsize of a 
unicode array by 4 (to get the number of actual unicode characters in 
the array).

I think the problem is now fixed.

Please try current SVN.


More information about the Scipy-dev mailing list