Skip to content

Commit 46eb4d0

Browse files
committed
fix to issue #922
1 parent 6edf6e2 commit 46eb4d0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Diff for: Changelog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
since version 1.5.1.1
2+
==============================
3+
* fix another slicing bug introduced by the fix to issue #906 (issue #922).
4+
15
version 1.5.1.1 (tag v1.5.1.1rel)
26
==================================
37
* fixed __version__ attribute (was set incorrectly in 1.5.1 release).

Diff for: netCDF4/utils.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,13 @@ def _StartCountStride(elem, shape, dimensions=None, grp=None, datashape=None,\
409409
if unlim and e.stop is not None and e.stop > shape[i]:
410410
length = e.stop
411411
elif unlim and e.stop is None and datashape != ():
412-
if e.start is None:
413-
length = datashape[i]
414-
else:
415-
length = e.start+datashape[i]
412+
try:
413+
if e.start is None:
414+
length = datashape[i]
415+
else:
416+
length = e.start+datashape[i]
417+
except IndexError:
418+
raise IndexError("Illegal slice")
416419
else:
417420
if unlim and datashape == () and len(dim) == 0:
418421
# writing scalar along unlimited dimension using slicing

0 commit comments

Comments
 (0)