[Numpy-discussion] Overlapping copy with object_ arrays

James Flowers jameseflowers1000 at yahoo.com
Mon Dec 4 17:04:02 CST 2006


Hello,

Having a problem with overlapping copies.  Memory being freed twice ???  See below:

ActivePython 2.4.3 Build 11 (ActiveState Software Inc.) based on
Python 2.4.3 (#1, Apr  3 2006, 18:07:14)
[GCC 4.0.1 (Apple Computer, Inc. build 5247)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> print numpy.__version__
1.0.1
>>> x = numpy.zeros(10, numpy.object_)
>>> x[:] = [],           # set the array to empy lists
>>> x[0] is x[1]      # everyone is of course identical
True
>>> x[3:-1] = x[4:]  # overlappping copy
>>> x           # all is right in the universe
array([[], [], [], [], [], [], [], [], [], []], dtype=object)
>>> for i in range(10): x[i] = []   # set the array with a loop
...
>>> x[0] is x[1]     # everyone is of course different
False
>>> x[3:-1] = x[4:]   # overlapping copy
>>> x            # oops, situation not OK, heap apparently corrupted by overlapping copy
Bus error

Jim





 
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061204/b9b8c993/attachment.html 


More information about the Numpy-discussion mailing list