Original ticket http://projects.scipy.org/numpy/ticket/1753 on 2011-03-03 by trac user bryancole, assigned to unknown.
If I create a memmap object:
>>> a = numpy.memmap("foo", mode="w+", shape=10)
then later I create a new array thus:
>>> b = numpy.empty_like(a)
then b is also a memmap object. However, even though the type of b is 'memmap', it has no _mmap attribute (as you'd expect, since empty_like cannot know what file object to use).
The broken memmap object b causes failures elsewhere in array_finalise as it tries to copy attributes from b (filename, offset, mode) which do not exist.
In summary there are TWO bugs here:
-
empty_like (and friends) should not return objects of type memmap
-
the memmap.array_finalise method is checking for the existence of the _mmap attribute. In non-memmap objects, this may exist but be set to None, therefore this method needs to check that both _mmap exists as an attribute and is not None.
Original ticket http://projects.scipy.org/numpy/ticket/1753 on 2011-03-03 by trac user bryancole, assigned to unknown.
If I create a memmap object:
then later I create a new array thus:
then b is also a memmap object. However, even though the type of b is 'memmap', it has no _mmap attribute (as you'd expect, since empty_like cannot know what file object to use).
The broken memmap object b causes failures elsewhere in array_finalise as it tries to copy attributes from b (filename, offset, mode) which do not exist.
In summary there are TWO bugs here:
empty_like (and friends) should not return objects of type memmap
the memmap.array_finalise method is checking for the existence of the _mmap attribute. In non-memmap objects, this may exist but be set to None, therefore this method needs to check that both _mmap exists as an attribute and is not None.