Skip to content

Commit 56289c8

Browse files
committed
Fix weird return_value_policy::reference in test_stl_binders, and enable those tests
1 parent 73b4a74 commit 56289c8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_stl_binders.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ TEST_SUBMODULE(stl_binders, m) {
8686

8787
// test_noncopyable_containers
8888
py::bind_vector<std::vector<E_nc>>(m, "VectorENC");
89-
m.def("get_vnc", &one_to_n<std::vector<E_nc>>, py::return_value_policy::reference);
89+
m.def("get_vnc", &one_to_n<std::vector<E_nc>>);
9090
py::bind_vector<std::deque<E_nc>>(m, "DequeENC");
91-
m.def("get_dnc", &one_to_n<std::deque<E_nc>>, py::return_value_policy::reference);
91+
m.def("get_dnc", &one_to_n<std::deque<E_nc>>);
9292
py::bind_map<std::map<int, E_nc>>(m, "MapENC");
93-
m.def("get_mnc", &times_ten<std::map<int, E_nc>>, py::return_value_policy::reference);
93+
m.def("get_mnc", &times_ten<std::map<int, E_nc>>);
9494
py::bind_map<std::unordered_map<int, E_nc>>(m, "UmapENC");
95-
m.def("get_umnc", &times_ten<std::unordered_map<int, E_nc>>, py::return_value_policy::reference);
95+
m.def("get_umnc", &times_ten<std::unordered_map<int, E_nc>>);
9696
// Issue #1885: binding nested std::map<X, Container<E>> with E non-copyable
9797
py::bind_map<std::map<int, std::vector<E_nc>>>(m, "MapVecENC");
9898
m.def("get_nvnc", [](int n)
@@ -102,11 +102,11 @@ TEST_SUBMODULE(stl_binders, m) {
102102
for (int j = 1; j <= n; j++)
103103
(*m)[i].emplace_back(j);
104104
return m;
105-
}, py::return_value_policy::reference);
105+
});
106106
py::bind_map<std::map<int, std::map<int, E_nc>>>(m, "MapMapENC");
107-
m.def("get_nmnc", &times_hundred<std::map<int, std::map<int, E_nc>>>, py::return_value_policy::reference);
107+
m.def("get_nmnc", &times_hundred<std::map<int, std::map<int, E_nc>>>);
108108
py::bind_map<std::unordered_map<int, std::unordered_map<int, E_nc>>>(m, "UmapUmapENC");
109-
m.def("get_numnc", &times_hundred<std::unordered_map<int, std::unordered_map<int, E_nc>>>, py::return_value_policy::reference);
109+
m.def("get_numnc", &times_hundred<std::unordered_map<int, std::unordered_map<int, E_nc>>>);
110110

111111
// test_vector_buffer
112112
py::bind_vector<std::vector<unsigned char>>(m, "VectorUChar", py::buffer_protocol());

0 commit comments

Comments
 (0)