mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-17 06:00:51 +00:00
Merge branch 'pybind:master' into master
This commit is contained in:
commit
ed5fb654c9
@ -108,7 +108,7 @@ repos:
|
||||
|
||||
# PyLint has native support - not always usable, but works for us
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: "v2.13.2"
|
||||
rev: "v2.13.4"
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^pybind11
|
||||
|
@ -1243,8 +1243,8 @@ struct arg_v : arg {
|
||||
private:
|
||||
template <typename T>
|
||||
arg_v(arg &&base, T &&x, const char *descr = nullptr)
|
||||
: arg(base), value(reinterpret_steal<object>(
|
||||
detail::make_caster<T>::cast(x, return_value_policy::automatic, {}))),
|
||||
: arg(base), value(reinterpret_steal<object>(detail::make_caster<T>::cast(
|
||||
std::forward<T>(x), return_value_policy::automatic, {}))),
|
||||
descr(descr)
|
||||
#if !defined(NDEBUG)
|
||||
,
|
||||
@ -1491,7 +1491,7 @@ private:
|
||||
type_id<T>());
|
||||
#endif
|
||||
}
|
||||
args_list.append(o);
|
||||
args_list.append(std::move(o));
|
||||
}
|
||||
|
||||
void process(list &args_list, detail::args_proxy ap) {
|
||||
|
@ -789,9 +789,9 @@ private:
|
||||
|
||||
list names, formats, offsets;
|
||||
for (auto &descr : field_descriptors) {
|
||||
names.append(descr.name);
|
||||
formats.append(descr.format);
|
||||
offsets.append(descr.offset);
|
||||
names.append(std::move(descr.name));
|
||||
formats.append(std::move(descr.format));
|
||||
offsets.append(std::move(descr.offset));
|
||||
}
|
||||
return dtype(std::move(names), std::move(formats), std::move(offsets), itemsize);
|
||||
}
|
||||
|
@ -268,10 +268,7 @@ public:
|
||||
/// Copy constructor; always increases the reference count
|
||||
object(const object &o) : handle(o) { inc_ref(); }
|
||||
/// Move constructor; steals the object from ``other`` and preserves its reference count
|
||||
object(object &&other) noexcept {
|
||||
m_ptr = other.m_ptr;
|
||||
other.m_ptr = nullptr;
|
||||
}
|
||||
object(object &&other) noexcept : handle(other) { other.m_ptr = nullptr; }
|
||||
/// Destructor; automatically calls `handle::dec_ref()`
|
||||
~object() { dec_ref(); }
|
||||
|
||||
@ -1519,8 +1516,8 @@ private:
|
||||
class slice : public object {
|
||||
public:
|
||||
PYBIND11_OBJECT_DEFAULT(slice, object, PySlice_Check)
|
||||
slice(handle start, handle stop, handle step) {
|
||||
m_ptr = PySlice_New(start.ptr(), stop.ptr(), step.ptr());
|
||||
slice(handle start, handle stop, handle step)
|
||||
: object(PySlice_New(start.ptr(), stop.ptr(), step.ptr()), stolen_t{}) {
|
||||
if (!m_ptr) {
|
||||
pybind11_fail("Could not allocate slice object!");
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ struct set_caster {
|
||||
for (auto &&value : src) {
|
||||
auto value_ = reinterpret_steal<object>(
|
||||
key_conv::cast(forward_like<T>(value), policy, parent));
|
||||
if (!value_ || !s.add(value_)) {
|
||||
if (!value_ || !s.add(std::move(value_))) {
|
||||
return handle();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user