Skip to content

Commit 5c5682e

Browse files
committed
BF: work round Python bz2 bug
Python 3.3 sometimes has a bug writing empty strings to bz2 - see: * http://bugs.python.org/issue16828 * ilanschnell/bsdiff4#3
1 parent 52106e4 commit 5c5682e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

nibabel/tests/test_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ def test_array_from_file_openers():
233233
(0, 5, 10)):
234234
fname = 'test.bin' + ext
235235
with Opener(fname, 'wb') as out_buf:
236-
out_buf.write(b' ' * offset)
236+
if offset != 0: # avoid http://bugs.python.org/issue16828
237+
out_buf.write(b' ' * offset)
237238
out_buf.write(in_arr.tostring(order='F'))
238239
with Opener(fname, 'rb') as in_buf:
239240
out_arr = array_from_file(shape, dtype, in_buf, offset)

0 commit comments

Comments
 (0)