diff options
Diffstat (limited to 'numpy/core/ma.py')
-rw-r--r-- | numpy/core/ma.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py index 063baa455..52447d236 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -1215,11 +1215,17 @@ array(data = %(data)s, try: result = numeric.array(d, dtype=d.dtype, copy=1) result[m] = value - except: + except (TypeError, AttributeError): #ok, can't put that value in here value = numeric.array(value, dtype=object) d = d.astype(object) result = oldnumeric.choose(m, (d, value)) + except IndexError: + #ok, if scalar + if d.shape: + raise + else: + result = numeric.array(value, dtype=d.dtype) return result def ids (self): |