mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 09:25:51 +00:00
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.
This commit is contained in:
parent
0b14d5bce9
commit
d373a082ad
@ -1771,12 +1771,7 @@ struct property_cpp_function<
|
||||
|
||||
template <typename PM, must_be_member_function_pointer<PM> = 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));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user