Skip to content

Commit 2452a0f

Browse files
committed
RF: Drop SAFE_STRINGERS, depend on bz2file to provide .readinto()
1 parent c0440e0 commit 2452a0f

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

nibabel/volumeutils.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@
4242
#: file-like classes known to hold compressed data
4343
COMPRESSED_FILE_LIKES = (gzip.GzipFile, bz2.BZ2File)
4444

45-
#: file-like classes known to return string values that are safe to modify
46-
SAFE_STRINGERS = (gzip.GzipFile, bz2.BZ2File)
47-
4845

4946
class Recoder(object):
5047
''' class to return canonical code(s) from code or aliases
@@ -530,7 +527,7 @@ def array_from_file(shape, in_dtype, infile, offset=0, order='F', mmap=True):
530527
else:
531528
data_bytes = infile.read(n_bytes)
532529
n_read = len(data_bytes)
533-
needs_copy = not isinstance(infile, SAFE_STRINGERS)
530+
needs_copy = True
534531
if n_bytes != n_read:
535532
raise IOError('Expected {0} bytes, got {1} bytes from {2}\n'
536533
' - could the file be damaged?'.format(

0 commit comments

Comments
 (0)