Skip to content

Commit a0a30c4

Browse files
committed
Merge branch 'master' into sh_merge_master
2 parents e41fb99 + 617cb65 commit a0a30c4

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

include/pybind11/detail/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ struct instance {
522522
void allocate_layout();
523523

524524
/// Destroys/deallocates all of the above
525-
void deallocate_layout() const;
525+
void deallocate_layout();
526526

527527
/// Returns the value_and_holder wrapper for the given type (or the first, if `find_type`
528528
/// omitted). Returns a default-constructed (with `.inst = nullptr`) object on failure if

include/pybind11/detail/type_caster_base.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ struct value_and_holder {
241241
? inst->simple_holder_constructed
242242
: (inst->nonsimple.status[index] & instance::status_holder_constructed) != 0u;
243243
}
244-
void set_holder_constructed(bool v = true) const {
244+
// NOLINTNEXTLINE(readability-make-member-function-const)
245+
void set_holder_constructed(bool v = true) {
245246
if (inst->simple_layout)
246247
inst->simple_holder_constructed = v;
247248
else if (v)
@@ -254,7 +255,8 @@ struct value_and_holder {
254255
? inst->simple_instance_registered
255256
: ((inst->nonsimple.status[index] & instance::status_instance_registered) != 0);
256257
}
257-
void set_instance_registered(bool v = true) const {
258+
// NOLINTNEXTLINE(readability-make-member-function-const)
259+
void set_instance_registered(bool v = true) {
258260
if (inst->simple_layout)
259261
inst->simple_instance_registered = v;
260262
else if (v)
@@ -397,7 +399,8 @@ PYBIND11_NOINLINE void instance::allocate_layout() {
397399
owned = true;
398400
}
399401

400-
PYBIND11_NOINLINE void instance::deallocate_layout() const {
402+
// NOLINTNEXTLINE(readability-make-member-function-const)
403+
PYBIND11_NOINLINE void instance::deallocate_layout() {
401404
if (!simple_layout)
402405
PyMem_Free(nonsimple.values_and_holders);
403406
}

include/pybind11/pytypes.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,7 @@ class dict : public object {
13931393
bool empty() const { return size() == 0; }
13941394
detail::dict_iterator begin() const { return {*this, 0}; }
13951395
detail::dict_iterator end() const { return {}; }
1396-
void clear() const { PyDict_Clear(ptr()); }
1396+
void clear() /* py-non-const */ { PyDict_Clear(ptr()); }
13971397
template <typename T> bool contains(T &&key) const {
13981398
return PyDict_Contains(m_ptr, detail::object_or_cast(std::forward<T>(key)).ptr()) == 1;
13991399
}
@@ -1435,10 +1435,10 @@ class list : public object {
14351435
detail::item_accessor operator[](handle h) const { return object::operator[](h); }
14361436
detail::list_iterator begin() const { return {*this, 0}; }
14371437
detail::list_iterator end() const { return {*this, PyList_GET_SIZE(m_ptr)}; }
1438-
template <typename T> void append(T &&val) const {
1438+
template <typename T> void append(T &&val) /* py-non-const */ {
14391439
PyList_Append(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr());
14401440
}
1441-
template <typename T> void insert(size_t index, T &&val) const {
1441+
template <typename T> void insert(size_t index, T &&val) /* py-non-const */ {
14421442
PyList_Insert(m_ptr, static_cast<ssize_t>(index),
14431443
detail::object_or_cast(std::forward<T>(val)).ptr());
14441444
}
@@ -1455,10 +1455,10 @@ class set : public object {
14551455
}
14561456
size_t size() const { return (size_t) PySet_Size(m_ptr); }
14571457
bool empty() const { return size() == 0; }
1458-
template <typename T> bool add(T &&val) const {
1458+
template <typename T> bool add(T &&val) /* py-non-const */ {
14591459
return PySet_Add(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) == 0;
14601460
}
1461-
void clear() const { PySet_Clear(m_ptr); }
1461+
void clear() /* py-non-const */ { PySet_Clear(m_ptr); }
14621462
template <typename T> bool contains(T &&val) const {
14631463
return PySet_Contains(m_ptr, detail::object_or_cast(std::forward<T>(val)).ptr()) == 1;
14641464
}

0 commit comments

Comments
 (0)