From 8f9513e5f3c31383d09278888825632396936f7e Mon Sep 17 00:00:00 2001 From: guangzhi Date: Thu, 1 Apr 2021 12:53:17 +0800 Subject: [PATCH] fix issue #416 by adding more integer type checks Attempt to fix issue https://github.com/CDAT/cdms/issues/416. Integers of type `numpy.int64` would fail the type check `isinstance(key, int)` in `specs2slices()` in avariable.py. Change to `isinstance(key, (int, numpy.int32, numpy.int64))` to fix this. --- Lib/avariable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/avariable.py b/Lib/avariable.py index f39e7e05..1e99fe89 100644 --- a/Lib/avariable.py +++ b/Lib/avariable.py @@ -1490,7 +1490,7 @@ def specs2slices(self, speclist, force=None): slicelist = [] for i in range(self.rank()): key = speclist[i] - if isinstance(key, int): # x[i] + if isinstance(key, (int, numpy.int32, numpy.int64)): # x[i] slicelist.append(slice(key, key + 1)) elif isinstance(key, slice): # x[i:j:k] slicelist.append(key)