summaryrefslogtreecommitdiff
path: root/numpy/core/memmap.py
diff options
context:
space:
mode:
authorSveinung Gundersen <sveinugu@gmail.com>2012-07-03 11:31:40 +0200
committerThouis (Ray) Jones <thouis@gmail.com>2012-07-03 11:31:40 +0200
commit731cf3aaaa95c714361f4062e6929f5a324586cc (patch)
tree191aa9162f6275be62330ba10c991f1d945228ea /numpy/core/memmap.py
parente15d0bdd3cc0bc0928e1f4d0b419a2fb3de02af9 (diff)
downloadnumpy-731cf3aaaa95c714361f4062e6929f5a324586cc.tar.gz
BUG: fix incorrect references to parents in memmap children.
Diffstat (limited to 'numpy/core/memmap.py')
-rw-r--r--numpy/core/memmap.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py
index fe52b3a09..f068c7b6c 100644
--- a/numpy/core/memmap.py
+++ b/numpy/core/memmap.py
@@ -4,7 +4,7 @@ import warnings
from numeric import uint8, ndarray, dtype
import sys
-from numpy.compat import asbytes
+import numpy as np
dtypedescr = dtype
valid_filemodes = ["r", "c", "r+", "w+"]
@@ -235,7 +235,7 @@ class memmap(ndarray):
if mode == 'w+' or (mode == 'r+' and flen < bytes):
fid.seek(bytes - 1, 0)
- fid.write(asbytes('\0'))
+ fid.write(np.compat.asbytes('\0'))
fid.flush()
if mode == 'c':
@@ -271,13 +271,16 @@ class memmap(ndarray):
return self
def __array_finalize__(self, obj):
- if hasattr(obj, '_mmap'):
+ if hasattr(obj, '_mmap') and np.may_share_memory(self, obj):
self._mmap = obj._mmap
self.filename = obj.filename
self.offset = obj.offset
self.mode = obj.mode
else:
self._mmap = None
+ self.filename = None
+ self.offset = None
+ self.mode = None
def flush(self):
"""