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))`.
This commit is contained in:
Oleksandr Pavlyk
2025-07-21 11:44:25 -05:00
parent d3071fb038
commit 11ae98389d

View File

@@ -76,7 +76,7 @@ struct benchmark_wrapper_t
benchmark_wrapper_t() = default;
explicit benchmark_wrapper_t(py::object o)
: m_fn{std::shared_ptr<py::object>(new py::object(o), PyObjectDeleter{})}
: m_fn{std::shared_ptr<py::object>(new py::object(std::move(o)), PyObjectDeleter{})}
{
if (!PyCallable_Check(m_fn->ptr()))
{