Skip to content
Snippets Groups Projects
user avatar
Tamito Kajiyama authored
The problem is that comparisons involving the constants Nature.POINT (for vertices) and
Nature.NO_FEATURE (for edges) were evaluated in a wrong way.  It is recalled that the
Nature class is a subclass of Python's built-in int type, and that these two constants are zero
when evaluated as numbers.  The issue was caused by the implementation of the constants
in an incompatible way for comparison with Python int (and boolean) values.  Specifically,
the zero of Python int is represented by an empty array of digits, whereas the zero-valued
Nature constants were represented by an array of size 1.  Python int comparison operators
first check the lengths of the arrays of two operands, and then start comparing the digits
only when the array length is the same.  For this reason, the two Nature constants were
not properly compared with int values (and thus with boolean values).  It is noted that the
zero-valued Nature constants may result from bitwise operations on other Nature constants
(e.g., Nature.SILHOUETTE & Nature.BORDER), so this issue must have affected many
existing style modules.

The problem was reported by Folkert de Vries (flokkievids) through personal communications.
Thanks a lot!
26b1406f
History
Name Last commit Last update
..