Эх сурвалжийг харах

fixed nasty memory bug in pybind11, appearing only with python 2.7 but also potentially affecting 3.x

Former-commit-id: d23c0b6c9bfe543afd9c099be9289af60142e1b3
Daniele Panozzo 9 жил өмнө
parent
commit
1524d4d294

+ 20 - 24
python/py_igl/py_slice.cpp

@@ -53,19 +53,16 @@ m.def("slice", []
 }, __doc_igl_slice,
 }, __doc_igl_slice,
 py::arg("X"), py::arg("R"), py::arg("Y"));
 py::arg("X"), py::arg("R"), py::arg("Y"));
 
 
-// // TODO: problematic!
-// m.def("slice", []
-// (
-//   const Eigen::MatrixXd& X,
-//   const Eigen::MatrixXi& R
-// )
-// {
-//   std::cerr << "Maybe also here?" << std::endl;
-//   // assert_is_VectorX("R",R);
-//   // return igl::slice(X,R);
-//   return;
-// }, __doc_igl_slice,
-// py::arg("X"), py::arg("R"));
+m.def("slice", []
+(
+  const Eigen::MatrixXd& X,
+  const Eigen::MatrixXi& R
+)
+{
+  assert_is_VectorX("R",R);
+  return igl::slice(X,R);
+}, __doc_igl_slice,
+py::arg("X"), py::arg("A"));
 
 
 m.def("slice", []
 m.def("slice", []
 (
 (
@@ -134,17 +131,16 @@ m.def("slice", []
 }, __doc_igl_slice,
 }, __doc_igl_slice,
 py::arg("X"), py::arg("R"), py::arg("Y"));
 py::arg("X"), py::arg("R"), py::arg("Y"));
 
 
-// TODO: Problematic
-// m.def("slice", []
-// (
-//   const Eigen::MatrixXi& X,
-//   const Eigen::MatrixXi& R
-// )
-// {
-//   assert_is_VectorX("R",R);
-//   return igl::slice(X,R);
-// }, __doc_igl_slice,
-// py::arg("X"), py::arg("R"));
+m.def("slice", []
+(
+  const Eigen::MatrixXi& X,
+  const Eigen::MatrixXi& R
+)
+{
+  assert_is_VectorX("R",R);
+  return igl::slice(X,R);
+}, __doc_igl_slice,
+py::arg("X"), py::arg("R"));
 
 
 m.def("slice", []
 m.def("slice", []
 (
 (