diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b75a03..903430c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ endif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CXX_FLAGS) set(CMAKE_CXX_STANDARD 11) -option(TEST "test example" ON) +option(TEST "test example" OFF) option(DEBUG "dev debug" OFF) file(GLOB PythonSOURCES @@ -27,7 +27,7 @@ include_directories(/src) if(NOT DEFINED VERSION_INFO) -set(VERSION_INFO "\"0.1.1\"") +set(VERSION_INFO "\"0.1.2\"") endif(NOT DEFINED VERSION_INFO) diff --git a/setup.py b/setup.py index c087c69..898726d 100644 --- a/setup.py +++ b/setup.py @@ -121,7 +121,7 @@ def build_extension(self, ext): # logic and declaration, and simpler if you include description/version in a file. setup( name="logReader", - version="0.1.1", + version="0.1.2", author="Kaiyao QIAO", author_email="ustkyqiao@gmail.com", description="reading lammps log file", diff --git a/src/python.cpp b/src/python.cpp index 5ce8d20..20132db 100644 --- a/src/python.cpp +++ b/src/python.cpp @@ -18,7 +18,9 @@ PYBIND11_MODULE(_logReader, m) { .def(py::init()) .def("read", (&logReader::read)) .def("describe", (&logReader::describe)) - .def("PythonAPI_getdata", (&logReader::PythonAPI_getdata)); + // by default pybind11 return policy is take onwership which is not necessary here + // change to reference to solve double free problem + .def("PythonAPI_getdata", (&logReader::PythonAPI_getdata), py::return_value_policy::reference); // .def("update", (&logReader::update), py::arg("n") = 1) // .def("getData", [](logReader &self) // { return intArray_t({self._size()}, self.getData()); }); @@ -26,6 +28,6 @@ PYBIND11_MODULE(_logReader, m) { #ifdef VERSION_INFO m.attr("__version__") = VERSION_INFO; #else - m.attr("__version__") = "0.0.1"; + m.attr("__version__") = "0.1.2"; #endif } \ No newline at end of file