From 170490ab110fbbc243b18b2f7e358ddda453138f Mon Sep 17 00:00:00 2001 From: Martin Bauer <martin.bauer@fau.de> Date: Tue, 10 Apr 2018 12:18:50 +0200 Subject: [PATCH] Fix: different index representation lead to wrong Field.access equality for fields without index dimensions the indices (0,) and () have been treated equivalently, but did not compare equal --- field.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/field.py b/field.py index 2f03f2ca6..24a51755f 100644 --- a/field.py +++ b/field.py @@ -362,7 +362,11 @@ class Field(object): raise ValueError("Indexing an already indexed Field.Access") idx = tuple(idx) - if len(idx) != self.field.indexDimensions and idx != (0,): + + if self.field.indexDimensions == 0 and idx == (0,): + idx = () + + if len(idx) != self.field.indexDimensions: raise ValueError("Wrong number of indices: " "Got %d, expected %d" % (len(idx), self.field.indexDimensions)) return Field.Access(self.field, self._offsets, idx) -- GitLab