mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
More precise return_value_policy::automatic documentation. (#2920)
* Adding test_return_vector_bool_raw_ptr to test_stl.py. * First attempt to make the documentation more accurate, but not trying to be comprehensive, to not bloat the reference table with too many details. * Fixing minor oversights. * Applying reviewer suggestion.
This commit is contained in:
committed by
GitHub
parent
ddf0efb990
commit
75090647ce
@@ -334,4 +334,10 @@ TEST_SUBMODULE(stl, m) {
|
||||
py::class_<Issue1561Outer>(m, "Issue1561Outer")
|
||||
.def(py::init<>())
|
||||
.def_readwrite("list", &Issue1561Outer::list);
|
||||
|
||||
m.def(
|
||||
"return_vector_bool_raw_ptr",
|
||||
[]() { return new std::vector<bool>(4513); },
|
||||
// Without explicitly specifying `take_ownership`, this function leaks.
|
||||
py::return_value_policy::take_ownership);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user