[SciPy-User] segfaults with weave.inline

Pauli Virtanen pav+sp@iki...
Tue Mar 2 05:47:31 CST 2010

Tue, 02 Mar 2010 03:21:25 -0800, Pitam Mitra wrote:
> I am creating a new median filter for an astronomy application. Due to
> speed issues, I decided to code it with weave.inline. However, I have
> run into segfaults and I have no clue what to do next.

You initialize

	zone_vector = array(())

but then the weave.inline code proceeds to write to positions

	zone_vector(0) ... zone_vector(n_pixels+1)

which are out of bounds. weave.inline probably does not do bounds 
checking, so you get a segfault instead of bounds error. The fix is to 
make zone_vector large enough.

Pauli Virtanen

More information about the SciPy-User mailing list