mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-19 22:39:09 +00:00
Adding .clang-tidy readability-braces-around-statements option.
clang-tidy automatic changes. NO manual changes.
This commit is contained in:
committed by
Ralf W. Grosse-Kunstleve
parent
8581584e60
commit
ddbc74c674
@@ -136,11 +136,16 @@ TEST_SUBMODULE(callbacks, m) {
|
||||
m.def("dummy_function_overloaded", [](int i, int j) { return i + j; });
|
||||
m.def("dummy_function_overloaded", &dummy_function);
|
||||
m.def("dummy_function2", [](int i, int j) { return i + j; });
|
||||
m.def("roundtrip", [](std::function<int(int)> f, bool expect_none = false) {
|
||||
if (expect_none && f)
|
||||
throw std::runtime_error("Expected None to be converted to empty std::function");
|
||||
return f;
|
||||
}, py::arg("f"), py::arg("expect_none")=false);
|
||||
m.def(
|
||||
"roundtrip",
|
||||
[](std::function<int(int)> f, bool expect_none = false) {
|
||||
if (expect_none && f) {
|
||||
throw std::runtime_error("Expected None to be converted to empty std::function");
|
||||
}
|
||||
return f;
|
||||
},
|
||||
py::arg("f"),
|
||||
py::arg("expect_none") = false);
|
||||
m.def("test_dummy_function", [](const std::function<int(int)> &f) -> std::string {
|
||||
using fn_type = int (*)(int);
|
||||
auto result = f.target<fn_type>();
|
||||
@@ -215,8 +220,9 @@ TEST_SUBMODULE(callbacks, m) {
|
||||
};
|
||||
|
||||
// spawn worker threads
|
||||
for (auto i : work)
|
||||
for (auto i : work) {
|
||||
start_f(py::cast<int>(i));
|
||||
}
|
||||
});
|
||||
|
||||
m.def("callback_num_times", [](const py::function &f, std::size_t num) {
|
||||
|
||||
Reference in New Issue
Block a user