diff options
author | Mitchell Faas <Faas.Mitchell@gmail.com> | 2021-01-31 16:21:47 +0100 |
---|---|---|
committer | Mitchell Faas <Faas.Mitchell@gmail.com> | 2021-01-31 16:21:47 +0100 |
commit | da39ec1322f93732b7a80402e3a1f1d0ddcf3a7b (patch) | |
tree | 1bf9cea24f54e1b7aeffff63cd53bf65a150c262 /numpy/core/arrayprint.py | |
parent | ef639359f4862762d97c215990f86a7a622c0f0d (diff) | |
download | numpy-da39ec1322f93732b7a80402e3a1f1d0ddcf3a7b.tar.gz |
BUG: Now allows for all integer types
Fixed a bug where precision couldn't be a non-native integer.
See comments on pull request #18263 for more info.
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r-- | numpy/core/arrayprint.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index 2d772c778..ffcddd9b2 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -41,6 +41,7 @@ from .numeric import concatenate, asarray, errstate from .numerictypes import (longlong, intc, int_, float_, complex_, bool_, flexible) from .overrides import array_function_dispatch, set_module +from operator import index import warnings import contextlib @@ -89,7 +90,9 @@ def _make_options_dict(precision=None, threshold=None, edgeitems=None, if precision is not None: # forbid the bad precision arg as suggested by issue #18254 - if not isinstance(precision, int): + try: + options['precision'] = index(precision) + except TypeError: raise TypeError('precision must be an integer') return options |