[Numpy-discussion] numpy segfaults with ctypes

Angus McMorland amcmorl@gmail....
Fri Aug 19 15:04:03 CDT 2011


Hi all,

I'm giving this email a new subject, in case that helps it catch the
attention of someone who can fix my problem. I currently cannot
upgrade numpy from git to any date more recent than 10 July. Git
commit feb8079070b8a659d7ee is the first that causes the problem
(according to github, the commit was authored by walshb and committed
by m-paradox, in case that jogs anyone's memory). I've tried taking a
look at the code diff, but I'm afraid I'm just a user, rather than a
developer, and it didn't make much sense.

My problem is that python segfaults when I run it with the following code:

> from ctypes import Structure, c_double
>
> #-- copied out of an xml2py generated file
> class S(Structure):
>    pass
> S._pack_ = 4
> S._fields_ = [
>    ('field', c_double * 2),
>   ]
> #--
>
> import numpy as np
> print np.version.version
> s = S()
> print "S", np.asarray(s.field)

Thanks,

Angus
-- 
AJC McMorland
Post-doctoral research fellow
Neurobiology, University of Pittsburgh


More information about the NumPy-Discussion mailing list