From 7e5faa0a9b0cd24c032310133cf54d2dabd6ff1f Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Thu, 21 Nov 2019 12:38:31 +0100 Subject: [PATCH] Avoid `hash()` in Field.hashable_contents hash should not be used in hashable_contents because even if we will use a deterministic hash function we will end up non-deterministic since hash is initialized with a random seed. --- pystencils/field.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pystencils/field.py b/pystencils/field.py index 0c196f4ba..1f09ba4e1 100644 --- a/pystencils/field.py +++ b/pystencils/field.py @@ -529,8 +529,13 @@ class Field(AbstractField): return Field.Access(self, center)(*args, **kwargs) def hashable_contents(self): - dth = hash(self._dtype) - return self._layout, self.shape, self.strides, dth, self.field_type, self._field_name, self.latex_name + return (self._layout, + self.shape, + self.strides, + self.field_type, + self._field_name, + self.latex_name, + self._dtype) def __hash__(self): return hash(self.hashable_contents()) -- GitLab