File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,17 @@ Release notes
6
6
Unreleased
7
7
----------
8
8
9
+ .. _release_2.11.1 :
10
+
11
+ 2.11.1
12
+ ------
9
13
10
14
Bug fixes
11
15
~~~~~~~~~
12
16
17
+ * Fix bug where indexing with a scalar numpy value returned a single-value array.
18
+ By :user: `Ben Jeffery <benjeffery> ` :issue: `967 `.
19
+
13
20
* Removed `clobber ` argument from `normalize_store_arg `. This enables to change
14
21
data within a opened consolidated group using mode `"r+" ` (i.e region write).
15
22
By :user: `Tobias Kölling <d70-t> ` :issue: `975 `.
Original file line number Diff line number Diff line change @@ -34,7 +34,10 @@ def is_integer_list(x):
34
34
35
35
36
36
def is_integer_array (x , ndim = None ):
37
- t = hasattr (x , 'shape' ) and hasattr (x , 'dtype' ) and x .dtype .kind in 'ui'
37
+ t = not np .isscalar (x ) and \
38
+ hasattr (x , 'shape' ) and \
39
+ hasattr (x , 'dtype' ) and \
40
+ x .dtype .kind in 'ui'
38
41
if ndim is not None :
39
42
t = t and len (x .shape ) == ndim
40
43
return t
Original file line number Diff line number Diff line change
1
+ import numpy
1
2
import numpy as np
2
3
import pytest
3
4
from numpy .testing import assert_array_equal
@@ -1442,3 +1443,11 @@ def test_slice_selection_uints():
1442
1443
idx = np .uint64 (3 )
1443
1444
slice_sel = make_slice_selection ((idx ,))
1444
1445
assert arr [slice_sel ].shape == (1 , 6 )
1446
+
1447
+
1448
+ def test_numpy_int_indexing ():
1449
+ a = np .arange (1050 )
1450
+ z = zarr .create (shape = 1050 , chunks = 100 , dtype = a .dtype )
1451
+ z [:] = a
1452
+ assert a [42 ] == z [42 ]
1453
+ assert a [numpy .int64 (42 )] == z [numpy .int64 (42 )]
You can’t perform that action at this time.
0 commit comments