problem with Path.contains_points

I've been converting my code that used nxutils.points_inside_poly (for checking if a point is inside a polygon) to instead use path.contains_points (since the former is now deprecated).
After reading the docs about creating Path objects, I thought I understood that I needed to supply the first vertex of the polygon twice - at the start of the array and at the end of the array, and that I needed to set the 'closed' argument to True in order to get the Path for a polygon.
But when I created Paths like that, I always seemed to get an array of all False's from path.contains_points.

Looking at the source code for the nxutils.points_inside_poly wrapper, I see that it creates Path's by just passing the polygon vertices (without the extra vertex at the end) and without the 'closed' flag. And the Path's created this way work correctly with path.contains_points.
Here's example code:

verts1 = [(0,0), (0,1), (1,1), (1,0)]
verts2 = [(0,0), (0,1), (1,1), (1,0), (0,0)]

path1 = Path(verts1)
path2 = Path(verts2, closed=True)

path1

Path([[ 0. 0.]
[ 0. 1.]
[ 1. 1.]
[ 1. 0.]], None)

path2

Path([[ 0. 0.]
[ 0. 1.]
[ 1. 1.]
[ 1. 0.]
[ 0. 0.]], [ 1 2 2 2 79])

points = [(0.5,0.5), (1.5,0.5)]

path1.contains_points(points)

array([ True, False], dtype=bool)

path2.contains_points(points)

array([False, False], dtype=bool)

The problem seems to occur when some of the points are inside and some are not.
If all of the points are inside, it works fine:

points = [(0.5,0.5), (0.51,0.51)]

path2.contains_points(points)

array([ True, True], dtype=bool)

ยทยทยท

--
Cameron Hayne
cameron.hayne@...287...