Skip to content

Commit d621316

Browse files
committed
FIX empty slice case
1 parent bf983bb commit d621316

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fitsio/hdu/image.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,11 @@ def _read_image_slice(self, arg):
278278
step = -1
279279

280280
# Sanity checks for proper syntax.
281-
if (step > 0 and stop < start) or (step < 0 and start < stop):
281+
if ((step > 0 and stop < start)
282+
or (step < 0 and start < stop)
283+
or (start == stop)):
282284
return numpy.empty(0, dtype=npy_dtype)
285+
283286
if start < 0:
284287
start = dims[dim] + start
285288
if start < 0:
@@ -293,6 +296,7 @@ def _read_image_slice(self, arg):
293296

294297
if stop > dims[dim]:
295298
stop = dims[dim]
299+
296300
if stop < start:
297301
# A little black magic here. The stop is offset by 2 to
298302
# accommodate the 1-offset of CFITSIO, and to move past the end

0 commit comments

Comments
 (0)