From da39ec1322f93732b7a80402e3a1f1d0ddcf3a7b Mon Sep 17 00:00:00 2001 From: Mitchell Faas Date: Sun, 31 Jan 2021 16:21:47 +0100 Subject: 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. --- numpy/core/arrayprint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'numpy/core/arrayprint.py') 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 -- cgit v1.2.1