summaryrefslogtreecommitdiff
path: root/numpy/core/oldnumeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/oldnumeric.py')
-rw-r--r--numpy/core/oldnumeric.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/oldnumeric.py b/numpy/core/oldnumeric.py
index 3773af6cc..e7c45ccc1 100644
--- a/numpy/core/oldnumeric.py
+++ b/numpy/core/oldnumeric.py
@@ -248,6 +248,8 @@ def resize(a, new_shape):
beyond current definition of a.
"""
+ if isinstance(new_shape, (int, nt.integer)):
+ new_shape = (new_shape,)
a = ravel(a)
Na = len(a)
if not Na: return mu.zeros(new_shape, a.dtypechar)
@@ -255,6 +257,9 @@ def resize(a, new_shape):
n_copies = int(total_size / Na)
extra = total_size % Na
+ if total_size == 0:
+ return a[:0]
+
if extra != 0:
n_copies = n_copies+1
extra = Na-extra