From e421f74585d4a1f980ddf4c8720caebdc0a91e0e Mon Sep 17 00:00:00 2001 From: Richard Christie Date: Mon, 22 Apr 2024 12:36:21 +1200 Subject: [PATCH] Avoid testing equality of Field and None --- src/scaffoldmaker/annotation/annotationgroup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scaffoldmaker/annotation/annotationgroup.py b/src/scaffoldmaker/annotation/annotationgroup.py index decc82fe..936550e3 100644 --- a/src/scaffoldmaker/annotation/annotationgroup.py +++ b/src/scaffoldmaker/annotation/annotationgroup.py @@ -357,7 +357,10 @@ def setMarkerMaterialCoordinates(self, materialCoordinatesField, materialCoordin markerNode = nodes.findNodeByIdentifier(self._markerIdentifier) with ChangeManager(fieldmodule): oldMaterialCoordinatesField, oldMaterialCoordinates = self.getMarkerMaterialCoordinates() - if materialCoordinatesField != oldMaterialCoordinatesField: + # comparing Zinc Field with None fails on some Python implementations: + if ((materialCoordinatesField and not oldMaterialCoordinatesField) or + (oldMaterialCoordinatesField and not materialCoordinatesField) or + (materialCoordinatesField != oldMaterialCoordinatesField)): nodetemplate = nodes.createNodetemplate() if self._markerMaterialCoordinatesField: assert RESULT_OK == nodetemplate.undefineField(self._markerMaterialCoordinatesField)