summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-11-30 11:33:36 -0500
committerMarten van Kerkwijk <mhvk@astro.utoronto.ca>2018-11-30 11:33:36 -0500
commit1842ea98e764d48e4d82636c995b86d1926fd124 (patch)
tree2a8b7c3970c02ae7bf6eb621c662ae86e897d111 /numpy/ma/core.py
parentb3a435305082699c26445630d9c79587d51ba9f1 (diff)
downloadnumpy-1842ea98e764d48e4d82636c995b86d1926fd124.tar.gz
BUG: IndexError for empty list on structured MaskedArray.
This should give an empty result, not an error. The problem was that the empty list was interpreted as a list of strings.
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py
index 4e6469812..96d7207bd 100644
--- a/numpy/ma/core.py
+++ b/numpy/ma/core.py
@@ -780,7 +780,7 @@ def fix_invalid(a, mask=nomask, copy=True, fill_value=None):
def is_string_or_list_of_strings(val):
return (isinstance(val, basestring) or
- (isinstance(val, list) and
+ (isinstance(val, list) and val and
builtins.all(isinstance(s, basestring) for s in val)))
###############################################################################
@@ -6340,7 +6340,7 @@ class MaskedConstant(MaskedArray):
def __copy__(self):
return self
-
+
def __deepcopy__(self, memo):
return self
@@ -7089,7 +7089,7 @@ def where(condition, x=_NoValue, y=_NoValue):
Parameters
----------
condition : array_like, bool
- Where True, yield `x`, otherwise yield `y`.
+ Where True, yield `x`, otherwise yield `y`.
x, y : array_like, optional
Values from which to choose. `x`, `y` and `condition` need to be
broadcastable to some shape.