8000 BUG: Revert linspace import for concatenation funcs (#12265) · numpy/numpy@437534b · GitHub
[go: up one dir, main page]

Skip to content

Commit 437534b

Browse files
jrbourbeaumattip
authored andcommitted
BUG: Revert linspace import for concatenation funcs (#12265)
BUG: test and fix import linspace in index_tricks
1 parent 5946502 commit 437534b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

numpy/lib/index_tricks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
)
1111
from numpy.core.numerictypes import find_common_type, issubdtype
1212

13-
from . import function_base
1413
import numpy.matrixlib as matrixlib
1514
from .function_base import diff
1615
from numpy.core.multiarray import ravel_multi_index, unravel_index
17-
from numpy.core import overrides
16+
from numpy.core import overrides, linspace
1817
from numpy.lib.stride_tricks import as_strided
1918

2019

@@ -346,7 +345,7 @@ def __getitem__(self, key):
346345
step = 1
347346
if isinstance(step, complex):
348347
size = int(abs(step))
349-
newobj = function_base.linspace(start, stop, num=size)
348+
newobj = linspace(start, stop, num=size)
350349
else:
351350
newobj = _nx.arange(start, stop, step)
352351
if ndmin > 1:

numpy/lib/tests/test_index_tricks.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ def test_more_mixed_type(self):
226226
g = r_[-10.1, np.array([1]), np.array([2, 3, 4]), 10.0]
227227
assert_(g.dtype == 'f8')
228228

229+
def test_complex_step(self):
230+
# Regression test for #12262
231+
g = r_[0:36:100j]
232+
assert_(g.shape == (100,))
233+
229234
def test_2d(self):
230235
b = np.random.rand(5, 5)
231236
c = np< 3808 /span>.random.rand(5, 5)

0 commit comments

Comments
 (0)
0