Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KyQiao committed Jul 22, 2021
1 parent fdc05c5 commit 2ca94f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
description="reading lammps log file",
Expand Down
6 changes: 4 additions & 2 deletions src/python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ PYBIND11_MODULE(_logReader, m) {
.def(py::init<const std::string&>())
.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()); });

#ifdef VERSION_INFO
m.attr("__version__") = VERSION_INFO;
#else
m.attr("__version__") = "0.0.1";
m.attr("__version__") = "0.1.2";
#endif
}

0 comments on commit 2ca94f0

Please sign in to comment.