Skip to content

Commit 64e4b9b

Browse files
committed
ENH: Improve comment explaining alias check for strings
1 parent c213f30 commit 64e4b9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

nibabel/nifti1.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,9 @@ def set_data_dtype(self, datatype):
21242124
>>> img.get_data_dtype() == np.dtype('int64')
21252125
True
21262126
"""
2127-
# Numpy dtype comparison can fail in odd ways, check for aliases only if str
2127+
# Comparing dtypes to strings, numpy will attempt to call, e.g., dtype('mask'),
2128+
# so only check for aliases if the type is a string
2129+
# See https://github.com/numpy/numpy/issues/7242
21282130
if isinstance(datatype, str):
21292131
# Static aliases
21302132
if datatype == 'mask':

0 commit comments

Comments
 (0)