diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-06-22 19:44:55 -0400 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-06-22 19:44:55 -0400 |
commit | 320667d42b1d56f12d911dfcee05fc264d9d6edb (patch) | |
tree | c4f4905b7f4a7f45f348f72638642c5a98a97bd8 /numpy/core/defchararray.py | |
parent | 81c2c16f3218c879f5bfeacd80f237336e56584d (diff) | |
parent | eef0e0ead3107d45c940480a40f66b7077f190bb (diff) | |
download | numpy-320667d42b1d56f12d911dfcee05fc264d9d6edb.tar.gz |
Merge pull request #5982 from embray/fix-chararray-slice
BUG: Fixed slicing of chararrays on Python 3.
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r-- | numpy/core/defchararray.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index cc6cb5a38..92ea8209c 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -1849,12 +1849,14 @@ class chararray(ndarray): def __getitem__(self, obj): val = ndarray.__getitem__(self, obj) - if issubclass(val.dtype.type, character) and not _len(val) == 0: + + if isinstance(val, character): temp = val.rstrip() if _len(temp) == 0: val = '' else: val = temp + return val # IMPLEMENTATION NOTE: Most of the methods of this class are |