Skip to content

Commit 3c18533

Browse files
committed
Merge branch 'master' into smart_holder
2 parents 4a3444a + bac5a0c commit 3c18533

4 files changed

+29
-14
lines changed

tests/pybind11_cross_module_tests.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
#include "pybind11_tests.h"
1111
#include "local_bindings.h"
1212
#include "test_exceptions.h"
13+
1314
#include <pybind11/stl_bind.h>
15+
1416
#include <numeric>
17+
#include <utility>
1518

1619
PYBIND11_MODULE(pybind11_cross_module_tests, m) {
1720
m.doc() = "pybind11 cross-module test module";
@@ -104,9 +107,10 @@ PYBIND11_MODULE(pybind11_cross_module_tests, m) {
104107
m.def("return_self", [](LocalVec *v) { return v; });
105108
m.def("return_copy", [](const LocalVec &v) { return LocalVec(v); });
106109

107-
// Changing this broke things with pygrep. TODO fix
108-
// NOLINTNEXTLINE
109-
class Dog : public pets::Pet { public: Dog(std::string name) : Pet(name) {}; };
110+
class Dog : public pets::Pet {
111+
public:
112+
Dog(std::string name) : Pet(std::move(name)) {}
113+
};
110114
py::class_<pets::Pet>(m, "Pet", py::module_local())
111115
.def("name", &pets::Pet::name);
112116
// Binding for local extending class:

tests/test_builtin_casters.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,12 @@ TEST_SUBMODULE(builtin_casters, m) {
151151
m.def("int_passthrough_noconvert", [](int arg) { return arg; }, py::arg{}.noconvert());
152152

153153
// test_tuple
154-
// NOLINTNEXTLINE(performance-unnecessary-value-param)
155-
m.def("pair_passthrough", [](std::pair<bool, std::string> input) {
156-
return std::make_pair(input.second, input.first);
157-
}, "Return a pair in reversed order");
154+
m.def(
155+
"pair_passthrough",
156+
[](const std::pair<bool, std::string> &input) {
157+
return std::make_pair(input.second, input.first);
158+
},
159+
"Return a pair in reversed order");
158160
m.def("tuple_passthrough", [](std::tuple<bool, std::string, int> input) {
159161
return std::make_tuple(std::get<2>(input), std::get<1>(input), std::get<0>(input));
160162
}, "Return a triple in reversed order");

tests/test_kwargs_and_defaults.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,15 @@ TEST_SUBMODULE(kwargs_and_defaults, m) {
106106
py::arg() = 3, "j"_a = 4, py::kw_only(), "k"_a = 5, "z"_a);
107107
m.def("kw_only_mixed", [](int i, int j) { return py::make_tuple(i, j); },
108108
"i"_a, py::kw_only(), "j"_a);
109-
// NOLINTNEXTLINE(performance-unnecessary-value-param)
110-
m.def("kw_only_plus_more", [](int i, int j, int k, py::kwargs kwargs) {
111-
return py::make_tuple(i, j, k, kwargs); },
112-
py::arg() /* positional */, py::arg("j") = -1 /* both */, py::kw_only(), py::arg("k") /* kw-only */);
109+
m.def(
110+
"kw_only_plus_more",
111+
[](int i, int j, int k, const py::kwargs &kwargs) {
112+
return py::make_tuple(i, j, k, kwargs);
113+
},
114+
py::arg() /* positional */,
115+
py::arg("j") = -1 /* both */,
116+
py::kw_only(),
117+
py::arg("k") /* kw-only */);
113118

114119
m.def("register_invalid_kw_only", [](py::module_ m) {
115120
m.def("bad_kw_only", [](int i, int j) { return py::make_tuple(i, j); },

tests/test_local_bindings.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010

1111
#include "pybind11_tests.h"
1212
#include "local_bindings.h"
13+
1314
#include <pybind11/stl.h>
1415
#include <pybind11/stl_bind.h>
16+
1517
#include <numeric>
18+
#include <utility>
1619

1720
TEST_SUBMODULE(local_bindings, m) {
1821
// test_load_external
@@ -86,9 +89,10 @@ TEST_SUBMODULE(local_bindings, m) {
8689
m.def("return_self", [](LocalVec *v) { return v; });
8790
m.def("return_copy", [](const LocalVec &v) { return LocalVec(v); });
8891

89-
// Reformatting this class broke pygrep checks
90-
// NOLINTNEXTLINE
91-
class Cat : public pets::Pet { public: Cat(std::string name) : Pet(name) {}; };
92+
class Cat : public pets::Pet {
93+
public:
94+
Cat(std::string name) : Pet(std::move(name)) {}
95+
};
9296
py::class_<pets::Pet>(m, "Pet", py::module_local())
9397
.def("get_name", &pets::Pet::name);
9498
// Binding for local extending class:

0 commit comments

Comments
 (0)