pybind11/tests
Ralf W. Grosse-Kunstleve 37d0bf4289
[smart_holder] Enable properties for non-owning holders (#4586)
* Add test_class_sh_property_non_owning.cpp,py

Failing:

```
__________________________________________________________ test_persistent_holder __________________________________________________________

    def test_persistent_holder():
        h = m.DataFieldsHolder(2)
>       c = h.vec_at(0).core_fld
E       RuntimeError: Non-owning holder (loaded_as_shared_ptr).

h          = <pybind11_tests.class_sh_property_non_owning.DataFieldsHolder object at 0x7fabab516470>

test_class_sh_property_non_owning.py:6: RuntimeError
__________________________________________________________ test_temporary_holder ___________________________________________________________

    def test_temporary_holder():
        d = m.DataFieldsHolder(2).vec_at(1)
>       c = d.core_fld
E       RuntimeError: Non-owning holder (loaded_as_shared_ptr).

d          = <pybind11_tests.class_sh_property_non_owning.DataField object at 0x7fabab548770>

test_class_sh_property_non_owning.py:13: RuntimeError
```

* Introduce `shared_ptr_from_python(responsible_parent)` and use in all `property_cpp_function`s with `const shared_ptr<T> &` arguments.

Tests are incomplete.

* Complete tests.

* Add comment for `smart_holder_type_caster_load<T>::shared_ptr_from_python`
2023-03-23 17:21:41 -07:00
..
extra_python_package
extra_setuptools
pure_cpp
test_cmake_build
test_embed
class_sh_module_local_0.cpp
class_sh_module_local_1.cpp
class_sh_module_local_2.cpp
CMakeLists.txt
conftest.py Change always_forkserver_on_unix() to use_multiprocessing_forkserver_on_linux() (#4577) 2023-03-16 14:33:34 -07:00
constructor_stats.h
cross_module_gil_utils.cpp
cross_module_interleaved_error_already_set.cpp
eigen_tensor_avoid_stl_array.cpp
env.py
local_bindings.h
namespace_visibility_1.cpp
namespace_visibility_1s.cpp
namespace_visibility_2.cpp
namespace_visibility.inl
object.h
pybind11_cross_module_tests.cpp
pybind11_tests.cpp
pybind11_tests.h
pytest.ini
requirements.txt
test_async.cpp
test_async.py
test_buffers.cpp
test_buffers.py
test_builtin_casters.cpp
test_builtin_casters.py
test_call_policies.cpp
test_call_policies.py
test_callbacks.cpp
test_callbacks.py
test_chrono.cpp
test_chrono.py
test_class_sh_basic.cpp
test_class_sh_basic.py
test_class_sh_disowning_mi.cpp
test_class_sh_disowning_mi.py
test_class_sh_disowning.cpp
test_class_sh_disowning.py
test_class_sh_factory_constructors.cpp
test_class_sh_factory_constructors.py
test_class_sh_inheritance.cpp
test_class_sh_inheritance.py
test_class_sh_mi_thunks.cpp
test_class_sh_mi_thunks.py
test_class_sh_module_local.py
test_class_sh_property_non_owning.cpp [smart_holder] Enable properties for non-owning holders (#4586) 2023-03-23 17:21:41 -07:00
test_class_sh_property_non_owning.py [smart_holder] Enable properties for non-owning holders (#4586) 2023-03-23 17:21:41 -07:00
test_class_sh_property.cpp
test_class_sh_property.py
test_class_sh_shared_ptr_copy_move.cpp
test_class_sh_shared_ptr_copy_move.py
test_class_sh_trampoline_basic.cpp
test_class_sh_trampoline_basic.py
test_class_sh_trampoline_self_life_support.cpp
test_class_sh_trampoline_self_life_support.py
test_class_sh_trampoline_shared_from_this.cpp
test_class_sh_trampoline_shared_from_this.py
test_class_sh_trampoline_shared_ptr_cpp_arg.cpp
test_class_sh_trampoline_shared_ptr_cpp_arg.py
test_class_sh_trampoline_unique_ptr.cpp
test_class_sh_trampoline_unique_ptr.py
test_class_sh_unique_ptr_member.cpp
test_class_sh_unique_ptr_member.py
test_class_sh_virtual_py_cpp_mix.cpp
test_class_sh_virtual_py_cpp_mix.py
test_class_sh_void_ptr_capsule.cpp
test_class_sh_void_ptr_capsule.py test_class_sh_void_ptr_capsule.py manual fixes for ruff 2023-02-22 13:01:46 -08:00
test_class.cpp
test_class.py
test_classh_mock.cpp
test_classh_mock.py
test_const_name.cpp
test_const_name.py
test_constants_and_functions.cpp
test_constants_and_functions.py
test_copy_move.cpp
test_copy_move.py
test_custom_type_casters.cpp
test_custom_type_casters.py
test_custom_type_setup.cpp
test_custom_type_setup.py
test_descr_src_loc.cpp
test_descr_src_loc.py
test_docstring_options.cpp
test_docstring_options.py
test_eigen_matrix.cpp
test_eigen_matrix.py
test_eigen_tensor.cpp
test_eigen_tensor.inl
test_eigen_tensor.py
test_enum.cpp
test_enum.py
test_eval_call.py
test_eval.cpp
test_eval.py
test_exc_namespace_visibility.py
test_exceptions.cpp
test_exceptions.h
test_exceptions.py
test_factory_constructors.cpp
test_factory_constructors.py
test_gil_scoped.cpp
test_gil_scoped.py
test_iostream.cpp
test_iostream.py
test_kwargs_and_defaults.cpp
test_kwargs_and_defaults.py
test_local_bindings.cpp
test_local_bindings.py
test_methods_and_attributes.cpp
test_methods_and_attributes.py
test_modules.cpp
test_modules.py Remove test code that does not exercise anything in pybind11, but breaks between Python 3.12alpha3 (still working) and 3.12alpha6 (broken): (#4559) 2023-03-09 13:02:34 -08:00
test_multiple_inheritance.cpp
test_multiple_inheritance.py
test_numpy_array.cpp
test_numpy_array.py
test_numpy_dtypes.cpp
test_numpy_dtypes.py
test_numpy_vectorize.cpp
test_numpy_vectorize.py
test_opaque_types.cpp
test_opaque_types.py
test_operator_overloading.cpp
test_operator_overloading.py
test_pickling.cpp
test_pickling.py
test_pytypes.cpp
test_pytypes.py
test_return_value_policy_override.cpp
test_return_value_policy_override.py
test_sequences_and_iterators.cpp
test_sequences_and_iterators.py
test_smart_ptr.cpp
test_smart_ptr.py
test_stl_binders.cpp
test_stl_binders.py
test_stl.cpp
test_stl.py
test_tagbased_polymorphic.cpp
test_tagbased_polymorphic.py
test_thread.cpp
test_thread.py
test_type_caster_odr_guard_1.cpp
test_type_caster_odr_guard_1.py
test_type_caster_odr_guard_2.cpp
test_type_caster_odr_guard_2.py
test_union.cpp
test_union.py
test_virtual_functions.cpp
test_virtual_functions.py
valgrind-numpy-scipy.supp
valgrind-python.supp