Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2022-05-25 09:35:06 +08:00 committed by GitHub
commit 260313f395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -267,7 +267,8 @@ TEST_SUBMODULE(builtin_casters, m) {
m.def("lvalue_nested", []() -> const decltype(lvnested) & { return lvnested; }); m.def("lvalue_nested", []() -> const decltype(lvnested) & { return lvnested; });
static std::pair<int, std::string> int_string_pair{2, "items"}; static std::pair<int, std::string> int_string_pair{2, "items"};
m.def("int_string_pair", []() { return &int_string_pair; }); m.def(
"int_string_pair", []() { return &int_string_pair; }, py::return_value_policy::reference);
// test_builtins_cast_return_none // test_builtins_cast_return_none
m.def("return_none_string", []() -> std::string * { return nullptr; }); m.def("return_none_string", []() -> std::string * { return nullptr; });

View File

@ -177,7 +177,8 @@ TEST_SUBMODULE(stl, m) {
[](const std::vector<bool> &v) { return v.at(0) == true && v.at(1) == false; }); [](const std::vector<bool> &v) { return v.at(0) == true && v.at(1) == false; });
// Unnumbered regression (caused by #936): pointers to stl containers aren't castable // Unnumbered regression (caused by #936): pointers to stl containers aren't castable
static std::vector<RValueCaster> lvv{2}; static std::vector<RValueCaster> lvv{2};
m.def("cast_ptr_vector", []() { return &lvv; }); m.def(
"cast_ptr_vector", []() { return &lvv; }, py::return_value_policy::reference);
// test_deque // test_deque
m.def("cast_deque", []() { return std::deque<int>{1}; }); m.def("cast_deque", []() { return std::deque<int>{1}; });