[Numpy-discussion] Crash with nested recarray on Python 3.x

Christoph Gohlke cgohlke@uci....
Thu Mar 10 00:37:17 CST 2011



On 3/9/2011 10:29 PM, Charles R Harris wrote:
>
>
> On Wed, Mar 9, 2011 at 11:20 PM, Christoph Gohlke <cgohlke@uci.edu
> <mailto:cgohlke@uci.edu>> wrote:
>
>     Hello,
>
>     the following code crashes in the last line when using numpy 1.5.1 on
>     Python 3.1 and 3.2, 32 and 64 bit, for Windows. It works with Python
>     2.x. Can anyone confirm the crash on other platforms?
>
>     import numpy
>     RECORD1 = [('i', 'i4')]
>     RECORD2 = [('j', RECORD1, 2)]
>     a = numpy.recarray((1,), RECORD2)
>     a.data
>
>
> Don't see it here.
>
> Python 3.1.2 (r312:79147, Sep  8 2010, 23:02:57)
> [GCC 4.5.1 20100812 (Red Hat 4.5.1-1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>> >> import numpy
>> >> RECORD1 = [('i', 'i4')]
>> >> RECORD2 = [('j', RECORD1, 2)]
>> >> a = numpy.recarray((1,), RECORD2)
>> >> a.data
> <memory at 0x1fbf478>
>> >> numpy.__version__
> '1.6.0.dev-3f0f12f'
>
> OTOH, the values look suspicious
>
>> >> a
> rec.array([(array([(-1770425816,), (62,)],
>        dtype=[('i', '<i4')]),)],
>        dtype=[('j', [('i', '<i4')], (2,))])
>
> Hmm...
>
> Chuck
>

Thank you. The values are uninitialized and are supposed to be read from 
file with "fd.readinto(a.data)", except that in my case the 'data' 
attribute lookup crashes.

Christoph


More information about the NumPy-Discussion mailing list