Skip to content

Commit

Permalink
Merge pull request #2761 from silx-kit/vallsv-patch-1
Browse files Browse the repository at this point in the history
[shapes] ValueError if the array do not have the right shape
  • Loading branch information
t20100 authored Oct 2, 2019
2 parents d8d5d49 + 3a8b5dc commit da50890
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions silx/image/shapes.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ cdef class Polygon(object):

def __init__(self, vertices):
self.vertices = numpy.ascontiguousarray(vertices, dtype=numpy.float32)
if self.vertices.ndim != 2 or self.vertices.shape[1] != 2:
raise ValueError("A list of 2d vertices is expected (n,2 dimensional array)")
self.nvert = self.vertices.shape[0]

def is_inside(self, row, col):
Expand Down

0 comments on commit da50890

Please sign in to comment.