File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1802,6 +1802,8 @@ class Delaunay(_QhullUser):
1802
1802
if np.ma.isMaskedArray(points):
1803
1803
raise ValueError (' Input points cannot be a masked array' )
1804
1804
points = np.ascontiguousarray(points, dtype = np.double)
1805
+ if points.ndim != 2 :
1806
+ raise ValueError (" Input points array must have 2 dimensions." )
1805
1807
1806
1808
if qhull_options is None :
1807
1809
if not incremental:
@@ -2592,6 +2594,8 @@ class Voronoi(_QhullUser):
2592
2594
if np.ma.isMaskedArray(points):
2593
2595
raise ValueError (' Input points cannot be a masked array' )
2594
2596
points = np.ascontiguousarray(points, dtype = np.double)
2597
+ if points.ndim != 2 :
2598
+ raise ValueError (" Input points array must have 2 dimensions." )
2595
2599
2596
2600
if qhull_options is None :
2597
2601
if not incremental:
Original file line number Diff line number Diff line change @@ -1178,3 +1178,11 @@ def test_cube(self):
1178
1178
assert set (a ) == set (b ) # facet orientation can differ
1179
1179
1180
1180
assert_allclose (hs .dual_points , qhalf_points )
1181
+
1182
+
1183
+ @pytest .mark .parametrize ("diagram_type" , [Voronoi , qhull .Delaunay ])
1184
+ def test_gh_20623 (diagram_type ):
1185
+ rng = np .random .default_rng (123 )
1186
+ invalid_data = rng .random ((4 , 10 , 3 ))
1187
+ with pytest .raises (ValueError , match = "dimensions" ):
1188
+ diagram_type (invalid_data )
You can’t perform that action at this time.
0 commit comments