@@ -83,7 +83,11 @@ static PyObject *Py_points_in_path(PyObject *self, PyObject *args)
8383 return NULL ;
8484 }
8585
86- npy_intp dims[] = { (npy_intp)points.size () };
86+ if (!check_trailing_shape (points, " points" , 2 )) {
87+ return NULL ;
88+ }
89+
90+ npy_intp dims[] = { (npy_intp)points.shape (0 ) };
8791 numpy::array_view<uint8_t , 1 > results (dims);
8892
8993 CALL_CPP (" points_in_path" , (points_in_path (points, r, path, trans, results)));
@@ -361,15 +365,19 @@ static PyObject *Py_affine_transform(PyObject *self, PyObject *args)
361365 numpy::array_view<double , 2 > vertices (vertices_arr);
362366 Py_DECREF (vertices_arr);
363367
364- npy_intp dims[] = { (npy_intp)vertices.size (), 2 };
368+ if (!check_trailing_shape (vertices, " vertices" , 2 )) {
369+ return NULL ;
370+ }
371+
372+ npy_intp dims[] = { (npy_intp)vertices.shape (0 ), 2 };
365373 numpy::array_view<double , 2 > result (dims);
366374 CALL_CPP (" affine_transform" , (affine_transform_2d (vertices, trans, result)));
367375 return result.pyobj ();
368376 } else { // PyArray_NDIM(vertices_arr) == 1
369377 numpy::array_view<double , 1 > vertices (vertices_arr);
370378 Py_DECREF (vertices_arr);
371379
372- npy_intp dims[] = { (npy_intp)vertices.size ( ) };
380+ npy_intp dims[] = { (npy_intp)vertices.shape ( 0 ) };
373381 numpy::array_view<double , 1 > result (dims);
374382 CALL_CPP (" affine_transform" , (affine_transform_1d (vertices, trans, result)));
375383 return result.pyobj ();
0 commit comments