summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authorAllan Haldane <allan.haldane@gmail.com>2018-02-25 14:52:41 -0500
committerAllan Haldane <allan.haldane@gmail.com>2018-03-05 22:50:47 -0500
commit04d2f0494f0fef2ede1461053b6cfc9bd37aaf2f (patch)
treed4c4e0063ce092a2552c6358a03fcce717a8fd61 /numpy/core/arrayprint.py
parent400607bdd44d7ad23a3fe666c796e9893b2bed46 (diff)
downloadnumpy-04d2f0494f0fef2ede1461053b6cfc9bd37aaf2f.tar.gz
BUG: Further back-compat fix for subclassed array repr
Fixes #10663
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index cbe95f51b..7dc73d6de 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -471,14 +471,15 @@ def _array2string(a, options, separator=' ', prefix=""):
# The formatter __init__s in _get_format_function cannot deal with
# subclasses yet, and we also need to avoid recursion issues in
# _formatArray with subclasses which return 0d arrays in place of scalars
- a = asarray(a)
+ data = asarray(a)
+ if a.shape == ():
+ a = data
if a.size > options['threshold']:
summary_insert = "..."
- data = _leading_trailing(a, options['edgeitems'])
+ data = _leading_trailing(data, options['edgeitems'])
else:
summary_insert = ""
- data = a
# find the right formatting function for the array
format_function = _get_format_function(data, **options)