Skip to content

Commit

Permalink
Merge pull request #252 from rchristie/field_compare_none
Browse files Browse the repository at this point in the history
Avoid testing equality of Field and None
  • Loading branch information
hsorby authored Apr 22, 2024
2 parents 6d9b67c + e421f74 commit d02ebbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/scaffoldmaker/annotation/annotationgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d02ebbd

Please sign in to comment.