diff options
author | Jaime <jaime.frio@gmail.com> | 2015-03-12 17:58:02 -0700 |
---|---|---|
committer | Jaime <jaime.frio@gmail.com> | 2015-03-12 17:58:02 -0700 |
commit | fd3b0fc2481cfe2aad960fe05baf11be46a0dd3f (patch) | |
tree | 4c1326274a5f93e6ded16e44e1084be1b07a5fc3 /numpy/lib/shape_base.py | |
parent | e84454aded855a70c3dcfd586a3a0c0e108d0ab7 (diff) | |
parent | 6eef837b4ae321e8bd2dffab4df68a4869f00860 (diff) | |
download | numpy-fd3b0fc2481cfe2aad960fe05baf11be46a0dd3f.tar.gz |
Merge pull request #5585 from Kreiswolke/BugFixTile
BUG: Fixed issue #4679 - make numpy.tile always return a copy
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r-- | numpy/lib/shape_base.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 2d18c5bc8..011434dda 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -850,7 +850,12 @@ def tile(A, reps): except TypeError: tup = (reps,) d = len(tup) - c = _nx.array(A, copy=False, subok=True, ndmin=d) + if all(x == 1 for x in tup) and isinstance(A, _nx.ndarray): + # Fixes the problem that the function does not make a copy if A is a + # numpy array and the repetitions are 1 in all dimensions + return _nx.array(A, copy=True, subok=True, ndmin=d) + else: + c = _nx.array(A, copy=False, subok=True, ndmin=d) shape = list(c.shape) n = max(c.size, 1) if (d < c.ndim): |