mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
chore: add missing moves for buffer_func and staticmethod in pybind11.h (#3969)
* Use move converting ctor when making class staticmethod * Add missing caster move in buffer func * fix use after move * add back move to staticmethod * avoid shadowing with varname
This commit is contained in:
parent
4624e8e164
commit
2d4a20c8cb
@ -1566,7 +1566,8 @@ public:
|
||||
scope(*this),
|
||||
sibling(getattr(*this, name_, none())),
|
||||
extra...);
|
||||
attr(cf.name()) = staticmethod(cf);
|
||||
auto cf_name = cf.name();
|
||||
attr(std::move(cf_name)) = staticmethod(std::move(cf));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1620,7 +1621,7 @@ public:
|
||||
if (!caster.load(obj, false)) {
|
||||
return nullptr;
|
||||
}
|
||||
return new buffer_info(((capture *) ptr)->func(caster));
|
||||
return new buffer_info(((capture *) ptr)->func(std::move(caster)));
|
||||
},
|
||||
ptr);
|
||||
weakref(m_ptr, cpp_function([ptr](handle wr) {
|
||||
|
Loading…
Reference in New Issue
Block a user