From d373a082addecec4e8f1451a152ff32aefbe7569 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 12 Jul 2024 02:33:30 -0700 Subject: [PATCH] Remove remaining BAKEIN_BREAK in test_class_sh_property.cpp,py and adjust (simplify) the `property_cpp_function<...unique_ptr...>::write` implementation (all tests pass). This PR (#5213) at this commit also passes ASAN, MSAN, UBSAN testing with the Google-internal toolchain. --- include/pybind11/pybind11.h | 7 +------ tests/test_class_sh_property.cpp | 4 ++-- tests/test_class_sh_property.py | 2 -- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 49f278561..71220e4f1 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -1771,12 +1771,7 @@ struct property_cpp_function< template = 0> static cpp_function write(PM pm, const handle &hdl) { - detail::type_info *tinfo = detail::get_type_info(typeid(T), /*throw_if_missing=*/true); - if (tinfo->default_holder) { - return cpp_function([pm](T &c, D &&value) { c.*pm = std::move(value); }, - is_method(hdl)); - } - return cpp_function([pm](T &c, const D &value) { c.*pm = value; }, is_method(hdl)); + return cpp_function([pm](T &c, D &&value) { c.*pm = std::move(value); }, is_method(hdl)); } }; diff --git a/tests/test_class_sh_property.cpp b/tests/test_class_sh_property.cpp index a553935bb..35615cec6 100644 --- a/tests/test_class_sh_property.cpp +++ b/tests/test_class_sh_property.cpp @@ -73,9 +73,9 @@ TEST_SUBMODULE(class_sh_property, m) { .def_readwrite("m_cptr_readwrite", &Outer::m_cptr) // .def_readonly("m_uqmp_readonly", &Outer::m_uqmp) // Custom compilation Error. - // BAKEIN_BREAK .def_readwrite("m_uqmp_readwrite", &Outer::m_uqmp) + .def_readwrite("m_uqmp_readwrite", &Outer::m_uqmp) // .def_readonly("m_uqcp_readonly", &Outer::m_uqcp) // Custom compilation Error. - // BAKEIN_BREAK .def_readwrite("m_uqcp_readwrite", &Outer::m_uqcp) + .def_readwrite("m_uqcp_readwrite", &Outer::m_uqcp) .def_readwrite("m_shmp_readonly", &Outer::m_shmp) .def_readwrite("m_shmp_readwrite", &Outer::m_shmp) diff --git a/tests/test_class_sh_property.py b/tests/test_class_sh_property.py index 5a045a3f9..9aeef44e0 100644 --- a/tests/test_class_sh_property.py +++ b/tests/test_class_sh_property.py @@ -83,7 +83,6 @@ def test_ptr(field_type, num_default, outer_type, m_attr, r_kind): @pytest.mark.parametrize("m_attr_readwrite", ["m_uqmp_readwrite", "m_uqcp_readwrite"]) def test_uqp(m_attr_readwrite): - pytest.skip(f"BAKEIN_BREAK: {m_attr_readwrite} does not build") outer = m.Outer() assert getattr(outer, m_attr_readwrite) is None field_orig = m.Field() @@ -136,7 +135,6 @@ def _proxy_dereference(proxy, xxxattr, *args, **kwargs): @pytest.mark.parametrize("m_attr", ["m_uqmp", "m_uqcp"]) def test_unique_ptr_field_proxy_poc(m_attr): m_attr_readwrite = m_attr + "_readwrite" - pytest.skip(f"BAKEIN_BREAK: {m_attr_readwrite} does not build") outer = m.Outer() field_orig = m.Field() field_orig.num = 45