[Numpy-discussion] memory corruption bug

Sven Schreiber svetosch at gmx.net
Sat Aug 26 07:13:30 CDT 2006


Hi,
I experienced this strange bug which caused a totally unrelated variable
to be overwritten (no exception or error was raised, so it took me while
to rule out any errors of my own).

The context where this is in is a method of a class (Vecm.getSW()), and
the instance of Vecm is created within a different class (GG.__init__).
Now, the affected variable is in the namespace of GG (it's GG.urate),
and so I would think that anything local in Vecm.getSW() should not
affect GG.urate, right?

Originally I did:

glx[lag:, :] -= temp

But that caused the described problem. Then I tried:

glx[lag:, :] = glx[lag:, :] - temp

But the same problem remains. Then I worked around the slice assignment
like this:

temp4 = r_[zeros([lag, n_y]), temp]
glx = glx - temp4

And everything is ok! However, when I alter the second line of this
workaround to:

glx -= temp4

The problem reappears! So I'm not even sure whether this is one or two
bugs...

This is with yesterday's numpy svn on windows, but the same thing
happens with an earlier svn (~b2) as well. If you need further info,
please tell me how to provide it.

Thanks,
Sven







More information about the Numpy-discussion mailing list