Skip to content

_points_equal incorrectly compares floats with is not #19

@craigds

Description

@craigds

I noticed add_ring is not treating my closed ring like a closed ring:

ipdb> pt1
(19188372.37109346, -5402212.477493137)
ipdb> pt2
(19188372.37109346, -5402212.477493137)
ipdb> n
> /Users/cdestigter/checkout/sno/sno/pyvendor/vector_tile_base/engine.py(314)_points_equal()
    313         if pt1[0] is not pt2[0] or pt1[1] is not pt2[1] or (self._has_elevation and pt1[2] is not pt2[2]):
--> 314             return False
    315         return True

ipdb> pt1[0] == pt2[0]
True
ipdb> pt1[0] is pt2[0]
False

is not isn't the appropriate comparator here, it shoudl be !=. python doesn't guarantee two equal floats are the same float.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions