[Numpy-discussion] numpy record array segfault

Nils Wagner nwagner@iam.uni-stuttgart...
Wed Feb 20 01:22:53 CST 2008


On Tue, 19 Feb 2008 17:10:10 -0600
  "Sameer DCosta" <sameerslists@gmail.com> wrote:
> Hi,
> 
> I'm getting a segfault when using python objects with 
>record arrays.
> The code (below) basically assigns a single datetime 
>object to a slice
> of a column in the record array and then python 
>segfaults as soon as I
> try to access those array values. I'm using the latest 
>svn version of
> numpy compiled with gcc 3.4.1 on Solaris (intel). Any 
>ideas why this
> is happening? A reference counting problem maybe? Thanks 
>for taking a
> look.
> 
> Sameer
> 
> johnh@flag:~> gcc --version
> gcc (GCC) 3.4.1
> Copyright (C) 2004 Free Software Foundation, Inc.
> This is free software; see the source for copying 
>conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A 
>PARTICULAR PURPOSE.
> 
> johnh@flag:~> uname -a
> SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc
> johnh@flag:~> python -V
> Python 2.4.2
> johnh@flag:~> cat tmp.py
> import datetime
> import numpy as np
> 
> print np.__version__
> 
> def myfunc(N):
>   newrec = np.empty(N, dtype=[('date', '|O4'), ('age', 
>int)])
>   newrec['date'] = datetime.date(2002,1,1)
>   newrec['age'] = 22
> 
> 
>   newrec['date'][1:12] = datetime.date(2003,1,1)
>   return newrec.view(np.recarray)
> 
> 
> if __name__=='__main__':
>   newrec = myfunc(29)
>   print newrec['date']
> 
> johnh@flag:~> python ~/tmp.py
> 1.0.5.dev4812
> Segmentation Fault (core dumped)
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion

  
No problem here

python tmp.py
1.0.5.dev4811
[2002-01-01 2003-01-01 2003-01-01 2003-01-01 2003-01-01 
2003-01-01
  2003-01-01 2003-01-01 2003-01-01 2003-01-01 2003-01-01 
2003-01-01
  2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01 
2002-01-01
  2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01 
2002-01-01
  2002-01-01 2002-01-01 2002-01-01 2002-01-01 2002-01-01]

Can you send a backtrace (gdb) ?

Nils


More information about the Numpy-discussion mailing list