summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-04-15 11:36:45 -0500
committerGitHub <noreply@github.com>2020-04-15 11:36:45 -0500
commitfc1f196584ff6dd530982febba2322679317c632 (patch)
tree8b0125c87d3eb2f85e3c150876721b853d96fd8c /numpy
parentc6916f44904b46c7c7bdb92ceb5242f3f6e00474 (diff)
parent3ec9d675a40fb8a7dc8f361870e3710b940553de (diff)
downloadnumpy-fc1f196584ff6dd530982febba2322679317c632.tar.gz
Merge pull request #15985 from eric-wieser/shorten-operator.index-backtrace
BUG: Avoid duplication in stack trace of `linspace(a, b, num=1.5)`
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/function_base.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py
index 6d49b9055..9e46f0ea5 100644
--- a/numpy/core/function_base.py
+++ b/numpy/core/function_base.py
@@ -110,13 +110,7 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None,
>>> plt.show()
"""
- try:
- num = operator.index(num)
- except TypeError:
- raise TypeError(
- "object of type {} cannot be safely interpreted as an integer."
- .format(type(num)))
-
+ num = operator.index(num)
if num < 0:
raise ValueError("Number of samples, %s, must be non-negative." % num)
div = (num - 1) if endpoint else num