Skip to content

Commit 0f26d00

Browse files
committed
[numpy2.0] fix numpy 2.0 incompatibility, works also with pre 2.0 versions
1 parent 5e3b83b commit 0f26d00

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

nixio/block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def create_data_frame(self, name="", type_="", col_dict=None,
349349
if isclass(dt):
350350
if issubclass(dt, str) or issubclass(dt, np.string_):
351351
col_dict[nam] = util.vlen_str_dtype
352-
if 'U' in str(dt) or dt == np.string_:
352+
if 'U' in str(dt) or dt == np.bytes_:
353353
col_dict[nam] = util.vlen_str_dtype
354354
dt_arr = list(col_dict.items())
355355
col_dtype = np.dtype(dt_arr)

nixio/hdf5/h5group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,9 @@ def copy(self, source, dest, name=None, cls=None, shallow=False,
290290
def change_id(_, igrp):
291291
if "entity_id" in igrp.attrs:
292292
id_ = util.create_id()
293-
igrp.attrs.modify("entity_id", np.string_(id_))
293+
igrp.attrs.modify("entity_id", np.bytes_(id_))
294294
id_ = util.create_id()
295-
grp.attrs.modify("entity_id", np.string_(id_))
295+
grp.attrs.modify("entity_id", np.bytes_(id_))
296296
grp.visititems(change_id)
297297
return grp
298298

0 commit comments

Comments
 (0)