diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-03-08 14:05:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 14:05:44 -0700 |
commit | 96684909b41c240a5ad8039393720d8bd9fc5ece (patch) | |
tree | 58b644b852b61feea51c180f0736390c3a90af22 /numpy/core/arrayprint.py | |
parent | 0311fa97057979384f5cc182d325ad6042e6b363 (diff) | |
parent | 04d2f0494f0fef2ede1461053b6cfc9bd37aaf2f (diff) | |
download | numpy-96684909b41c240a5ad8039393720d8bd9fc5ece.tar.gz |
Merge pull request #10698 from ahaldane/fix_0d_object_subclass_again
BUG: Further back-compat fix for subclassed array repr (forward port)
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 7 |
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) |