summaryrefslogtreecommitdiff
path: root/numpy/core/arrayprint.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2018-11-08 11:04:55 -0800
committermattip <matti.picus@gmail.com>2018-12-01 17:20:40 -0800
commit0f59087af94b4fba61138334bf8f9c375bf1ae55 (patch)
tree854a8d27458fac66520c0c6a87249a5f06915a9f /numpy/core/arrayprint.py
parentdc608ba2a85a7b89663bfd4d0ad977f40d0f813a (diff)
downloadnumpy-0f59087af94b4fba61138334bf8f9c375bf1ae55.tar.gz
BUG: test, fix for threshold='nan'
Diffstat (limited to 'numpy/core/arrayprint.py')
-rw-r--r--numpy/core/arrayprint.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py
index 075d75340..6a71de226 100644
--- a/numpy/core/arrayprint.py
+++ b/numpy/core/arrayprint.py
@@ -26,6 +26,7 @@ __docformat__ = 'restructuredtext'
import sys
import functools
+import numbers
if sys.version_info[0] >= 3:
try:
from _thread import get_ident
@@ -86,7 +87,11 @@ def _make_options_dict(precision=None, threshold=None, edgeitems=None,
if legacy not in [None, False, '1.13']:
warnings.warn("legacy printing option can currently only be '1.13' or "
"`False`", stacklevel=3)
-
+ if threshold is not None:
+ # forbid the bad threshold arg suggested by stack overflow, gh-12351
+ if not isinstance(threshold, numbers.Number) or np.isnan(threshold):
+ raise ValueError("threshold must be numeric and non-NAN, try "
+ "sys.maxsize for untruncated representation")
return options