|
11 | 11 |
|
12 | 12 | #include "pybind11_tests.h" |
13 | 13 |
|
14 | | -#include <utility> |
15 | | - |
16 | 14 | struct ConstRefCasted { |
17 | 15 | int tag; |
18 | 16 | }; |
19 | 17 |
|
20 | | -struct StringAttr { |
21 | | - explicit StringAttr(std::string v) : value(std::move(v)) {} |
22 | | - std::string value; |
23 | | -}; |
24 | | - |
25 | 18 | PYBIND11_NAMESPACE_BEGIN(pybind11) |
26 | 19 | PYBIND11_NAMESPACE_BEGIN(detail) |
27 | 20 | template <> |
@@ -390,29 +383,5 @@ TEST_SUBMODULE(builtin_casters, m) { |
390 | 383 | m.def("takes_const_ref_wrap", |
391 | 384 | [](std::reference_wrapper<const ConstRefCasted> x) { return x.get().tag; }); |
392 | 385 |
|
393 | | - // test return_value_policy::_return_as_bytes |
394 | | - m.def( |
395 | | - "invalid_utf8_string_as_bytes", |
396 | | - []() { return std::string("\xba\xd0\xba\xd0"); }, |
397 | | - py::return_value_policy::_return_as_bytes); |
398 | | - m.def("invalid_utf8_string_as_str", []() { return std::string("\xba\xd0\xba\xd0"); }); |
399 | | - m.def( |
400 | | - "invalid_utf8_char_array_as_bytes", |
401 | | - []() { return "\xba\xd0\xba\xd0"; }, |
402 | | - py::return_value_policy::_return_as_bytes); |
403 | | - py::class_<StringAttr>(m, "StringAttr") |
404 | | - .def(py::init<std::string>()) |
405 | | - .def_property( |
406 | | - "value", |
407 | | - py::cpp_function([](StringAttr &self) { return self.value; }, |
408 | | - py::return_value_policy::_return_as_bytes), |
409 | | - py::cpp_function([](StringAttr &self, std::string v) { self.value = std::move(v); })); |
410 | | -#ifdef PYBIND11_HAS_STRING_VIEW |
411 | | - m.def( |
412 | | - "invalid_utf8_string_view_as_bytes", |
413 | | - []() { return std::string_view("\xba\xd0\xba\xd0"); }, |
414 | | - py::return_value_policy::_return_as_bytes); |
415 | | -#endif |
416 | | - |
417 | 386 | PYBIND11_WARNING_POP |
418 | 387 | } |
0 commit comments