File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -289,12 +289,20 @@ def array(data, **kwargs):
289
289
data = np .asanyarray (data )
290
290
291
291
# setup dtype
292
- kwargs .setdefault ('dtype' , data .dtype )
292
+ kw_dtype = kwargs .get ('dtype' , None )
293
+ if kw_dtype is None :
294
+ kwargs ['dtype' ] = data .dtype
295
+ else :
296
+ kwargs ['dtype' ] = kw_dtype
293
297
294
298
# setup shape and chunks
295
- shape , chunks = _get_shape_chunks (data )
296
- kwargs ['shape' ] = data .shape
297
- kwargs .setdefault ('chunks' , chunks )
299
+ data_shape , data_chunks = _get_shape_chunks (data )
300
+ kwargs ['shape' ] = data_shape
301
+ kw_chunks = kwargs .get ('chunks' , None )
302
+ if kw_chunks is None :
303
+ kwargs ['chunks' ] = data_chunks
304
+ else :
305
+ kwargs ['chunks' ] = kw_chunks
298
306
299
307
# instantiate array
300
308
z = create (** kwargs )
Original file line number Diff line number Diff line change @@ -91,6 +91,12 @@ def test_array():
91
91
eq (c .shape , z5 .shape )
92
92
assert_is_instance (z5 .chunks , tuple )
93
93
94
+ # with dtype=None
95
+ a = np .arange (100 , dtype = 'i4' )
96
+ z = array (a , dtype = None )
97
+ assert_array_equal (a [:], z [:])
98
+ eq (a .dtype , z .dtype )
99
+
94
100
95
101
def test_empty ():
96
102
z = empty (100 , chunks = 10 )
You can’t perform that action at this time.
0 commit comments