Skip to content

Commit a507ffe

Browse files
Replace use of py::object copy constructor with use of move constructor
Change explicit constructor of benchmark_wrapper_t to use move-constructor of py::object instead of copy constructor by replacing `py::object(o)` with `py::object(std::move(o))`.
1 parent 3480759 commit a507ffe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/src/py_nvbench.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct benchmark_wrapper_t
7676
benchmark_wrapper_t() = default;
7777

7878
explicit benchmark_wrapper_t(py::object o)
79-
: m_fn{std::shared_ptr<py::object>(new py::object(o), PyObjectDeleter{})}
79+
: m_fn{std::shared_ptr<py::object>(new py::object(std::move(o)), PyObjectDeleter{})}
8080
{
8181
if (!PyCallable_Check(m_fn->ptr()))
8282
{

0 commit comments

Comments
 (0)