diff options
author | François Bissey <francois.bissey@canterbury.ac.nz> | 2015-11-10 14:25:34 +1300 |
---|---|---|
committer | François Bissey <francois.bissey@canterbury.ac.nz> | 2015-11-10 14:25:34 +1300 |
commit | 4f8e93a3b26f15bb96d86ee05d672b51cda1e935 (patch) | |
tree | d420adf4a1a21883e48999c285776f2af31937fc | |
parent | 694f628bb9bb0da4a05d279b22cdb0987e2b3203 (diff) | |
download | numpy-4f8e93a3b26f15bb96d86ee05d672b51cda1e935.tar.gz |
Let linspace accept input that has an array_interface but is not otherwise a numpy or python type.
-rw-r--r-- | numpy/core/function_base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index 05fea557a..5070608b7 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -87,8 +87,10 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None): div = (num - 1) if endpoint else num # Convert float/complex array scalars to float, gh-3504 - start = start * 1. - stop = stop * 1. + # Make sure one can use variables that have an __array_interface__, gh-6634 + from numpy import asarray + start = asarray(start) * 1. + stop = asarray(stop) * 1. dt = result_type(start, stop, float(num)) if dtype is None: |