diff options
author | Marten van Kerkwijk <mhvk@astro.utoronto.ca> | 2017-11-30 09:46:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-30 09:46:09 -0500 |
commit | 2c310911fa0e8fea0e4f237736fd28de97ebb4d0 (patch) | |
tree | 55d1fbc4626875e1bc8116d53f337bc9977621ca /numpy/core/arrayprint.py | |
parent | 1bef8624bbaa4753ffd3c5bf73fadc5b5f2f6de8 (diff) | |
parent | dcc919c7fbfbb5574a1a8b676566d06cbffa070a (diff) | |
download | numpy-2c310911fa0e8fea0e4f237736fd28de97ebb4d0.tar.gz |
Merge pull request #10131 from eric-wieser/fix-array2string-asarray
BUG: Fix downcasting in _array2string
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index e4be810b9..e4a048a42 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -427,12 +427,14 @@ def _recursive_guard(fillvalue='...'): # gracefully handle recursive calls, when object arrays contain themselves @_recursive_guard() def _array2string(a, options, separator=' ', prefix=""): + # The formatter __init__s cannot deal with subclasses yet + data = asarray(a) + if a.size > options['threshold']: summary_insert = "..." - data = _leading_trailing(a) + data = _leading_trailing(data) else: summary_insert = "" - data = asarray(a) # find the right formatting function for the array format_function = _get_format_function(data, **options) |