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 Merge branch 'master' into sh_merge_master3 2023-02-07 23:54:04 -08:00
extra_setuptools chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
pure_cpp Fix new (after upgrade) clang-tidy error, adjust .codespell-ignorelines accordingly. 2022-07-21 08:15:53 -07:00
test_cmake_build chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_embed Merge branch 'master' into sh_merge_master3 2023-02-07 23:54:04 -08:00
class_sh_module_local_0.cpp Adding py::smart_holder (for smart-pointer interoperability). (#2672) 2021-02-23 21:50:42 -08:00
class_sh_module_local_1.cpp Adding py::smart_holder (for smart-pointer interoperability). (#2672) 2021-02-23 21:50:42 -08:00
class_sh_module_local_2.cpp Adding py::smart_holder (for smart-pointer interoperability). (#2672) 2021-02-23 21:50:42 -08:00
CMakeLists.txt Merge branch 'master' into sh_merge_master 2023-02-16 15:02:47 -08:00
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 test: ConstructorStats newline (PyPy) (#4167) 2022-08-29 23:25:01 -04:00
cross_module_gil_utils.cpp Add PYBIND11_SIMPLE_GIL_MANAGEMENT option (cmake, C++ define) (#4216) 2022-10-30 08:57:23 -07:00
cross_module_interleaved_error_already_set.cpp Add error_scope to detail::get_internals() (#3981) 2022-05-31 11:51:13 -07:00
eigen_tensor_avoid_stl_array.cpp Fix ODR violations in our Eigen Tensor tests (#4412) 2022-12-20 05:34:00 -08:00
env.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
local_bindings.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
namespace_visibility_1.cpp [smart_holder] Add test_namespace_visibility (#4050) 2022-07-12 18:33:42 -07:00
namespace_visibility_1s.cpp [smart_holder] Add test_namespace_visibility (#4050) 2022-07-12 18:33:42 -07:00
namespace_visibility_2.cpp [smart_holder] Add test_namespace_visibility (#4050) 2022-07-12 18:33:42 -07:00
namespace_visibility.inl [smart_holder] Add test_namespace_visibility (#4050) 2022-07-12 18:33:42 -07:00
object.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_cross_module_tests.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
pybind11_tests.cpp Add PYBIND11_SIMPLE_GIL_MANAGEMENT option (cmake, C++ define) (#4216) 2022-10-30 08:57:23 -07:00
pybind11_tests.h Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
pytest.ini chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
requirements.txt Fix: 3.11 beta support (#3923) 2022-07-06 16:35:12 -04:00
test_async.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_async.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_buffers.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_buffers.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_builtin_casters.cpp Merge branch 'master' into sh_merge_master_3 2022-12-02 05:28:58 -08:00
test_builtin_casters.py Merge branch 'master' into sh_merge_master 2023-02-22 12:32:31 -08:00
test_call_policies.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_call_policies.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_callbacks.cpp Fix functional.h bug + introduce test to verify that it is fixed (#4254) 2022-11-18 10:08:11 -08:00
test_callbacks.py Always display python type information in cast errors (#4463) 2023-02-09 21:21:17 -08:00
test_chrono.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_chrono.py chore: update to black 23 (#4482) 2023-02-01 14:23:37 -05:00
test_class_sh_basic.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_basic.py trivial manual fixes for ruff 2023-02-22 13:00:31 -08:00
test_class_sh_disowning_mi.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_disowning_mi.py trivial manual fixes for ruff 2023-02-22 13:00:31 -08:00
test_class_sh_disowning.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_disowning.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_factory_constructors.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_factory_constructors.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_class_sh_inheritance.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_inheritance.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_mi_thunks.cpp [smart_holder] test_class_sh_mi_thunks (started from PR #4374) (#4380) 2022-12-12 19:55:16 -08:00
test_class_sh_mi_thunks.py [smart_holder] test_class_sh_mi_thunks (started from PR #4374) (#4380) 2022-12-12 19:55:16 -08:00
test_class_sh_module_local.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
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 [smart_holder] .def_readonly, .def_readwrite adaptors (continuation of PR #3581). (#3844) 2022-05-17 16:35:43 -07:00
test_class_sh_property.py trivial manual fixes for ruff 2023-02-22 13:00:31 -08:00
test_class_sh_shared_ptr_copy_move.cpp Remove unnamed namespace for compatibility with CUDA 11.7 (it does not make much sense anyway). 2022-10-09 21:57:51 -07:00
test_class_sh_shared_ptr_copy_move.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_trampoline_basic.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_trampoline_basic.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_class_sh_trampoline_self_life_support.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_trampoline_self_life_support.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_class_sh_trampoline_shared_from_this.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_trampoline_shared_from_this.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_trampoline_shared_ptr_cpp_arg.cpp [smart_holder] Add gil_scoped_acquire to shared_ptr_trampoline_self_life_support ctor. (#4196) 2022-10-07 12:24:49 -07:00
test_class_sh_trampoline_shared_ptr_cpp_arg.py [smart_holder] Add gil_scoped_acquire to shared_ptr_trampoline_self_life_support ctor. (#4196) 2022-10-07 12:24:49 -07:00
test_class_sh_trampoline_unique_ptr.cpp This was meant to be PR #3065: pure clang-format changes. NO manual changes. (#3073) 2021-07-02 16:51:24 -07:00
test_class_sh_trampoline_unique_ptr.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_unique_ptr_member.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_unique_ptr_member.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_virtual_py_cpp_mix.cpp Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_class_sh_virtual_py_cpp_mix.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_class_sh_void_ptr_capsule.cpp Fixes issue #3801 (#3807) 2022-03-18 11:08:20 -07:00
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 Merge branch 'master' into sh_merge_master 2023-01-03 19:40:01 -08:00
test_class.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_classh_mock.cpp Bug fix: adding back !is_alias<Class>(ptr) that were accidentally omitted. (#2958) 2021-04-19 10:54:37 -07:00
test_classh_mock.py Automatic pre-commit run --all-files and clang-tidy changes (NO manual changes). 2022-02-14 19:00:40 -08:00
test_const_name.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_const_name.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_constants_and_functions.cpp Introduce a new style of warning suppression based on push/pop (#4285) 2022-11-28 07:39:38 -08:00
test_constants_and_functions.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_copy_move.cpp Fix py::cast from pytype rvalue to pytype (#3949) 2022-05-16 13:51:01 -07:00
test_copy_move.py Fix py::cast from pytype rvalue to pytype (#3949) 2022-05-16 13:51:01 -07:00
test_custom_type_casters.cpp Open pybind11 namespace with consistent visility. (#4098) 2022-08-01 11:31:31 -07:00
test_custom_type_casters.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_custom_type_setup.cpp Add custom_type_setup attribute (#3287) 2021-09-24 12:08:22 -07:00
test_custom_type_setup.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_descr_src_loc.cpp clang-format automatic changes (due to clang-format update on master) 2022-12-08 23:25:36 -08:00
test_descr_src_loc.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_docstring_options.cpp Add option for enable/disable enum members in docstring. (#2768) 2022-12-08 23:10:10 -08:00
test_docstring_options.py Add option for enable/disable enum members in docstring. (#2768) 2022-12-08 23:10:10 -08:00
test_eigen_matrix.cpp Introduce a new style of warning suppression based on push/pop (#4285) 2022-11-28 07:39:38 -08:00
test_eigen_matrix.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_eigen_tensor.cpp Fix ODR violations in our Eigen Tensor tests (#4412) 2022-12-20 05:34:00 -08:00
test_eigen_tensor.inl Fix ODR violations in our Eigen Tensor tests (#4412) 2022-12-20 05:34:00 -08:00
test_eigen_tensor.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_enum.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_enum.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_eval_call.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_eval.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_eval.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_exc_namespace_visibility.py [smart_holder] Add test_namespace_visibility (#4050) 2022-07-12 18:33:42 -07:00
test_exceptions.cpp Always display python type information in cast errors (#4463) 2023-02-09 21:21:17 -08:00
test_exceptions.h Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_exceptions.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_factory_constructors.cpp Merge branch 'master' into sh_merge_master_after_clang-format_etc 2022-02-14 14:36:08 -08:00
test_factory_constructors.py Merge branch 'master' into sh_merge_master 2023-02-22 12:32:31 -08:00
test_gil_scoped.cpp Add PYBIND11_SIMPLE_GIL_MANAGEMENT option (cmake, C++ define) (#4216) 2022-10-30 08:57:23 -07:00
test_gil_scoped.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_iostream.cpp Dropping MSVC 2015 (#3722) 2022-02-14 11:36:22 -08:00
test_iostream.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_kwargs_and_defaults.cpp Introduce a new style of warning suppression based on push/pop (#4285) 2022-11-28 07:39:38 -08:00
test_kwargs_and_defaults.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_local_bindings.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_local_bindings.py chore: update to black 23 (#4482) 2023-02-01 14:23:37 -05:00
test_methods_and_attributes.cpp Merge branch 'master' into sh_merge_master 2022-05-02 12:41:48 -07:00
test_methods_and_attributes.py Merge branch 'master' into sh_merge_master 2023-02-22 12:32:31 -08:00
test_modules.cpp Add missing error handling to module_::def_submodule (#3973) 2022-05-28 16:40:57 -07:00
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 Merge branch 'master' into sh_merge_master_after_clang-format_etc 2022-02-14 14:36:08 -08:00
test_multiple_inheritance.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_numpy_array.cpp First draft of Eigen::Tensor support (#4201) 2022-10-18 16:54:16 -07:00
test_numpy_array.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_numpy_dtypes.cpp fix: avoid catch (...) for expected import numpy failures (#3974) 2022-05-26 11:07:40 -04:00
test_numpy_dtypes.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_numpy_vectorize.cpp fix: avoid catch (...) for expected import numpy failures (#3974) 2022-05-26 11:07:40 -04:00
test_numpy_vectorize.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_opaque_types.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_opaque_types.py chore: drop Python 3.5 (#3719) 2022-02-11 19:06:16 -05:00
test_operator_overloading.cpp Introduce a new style of warning suppression based on push/pop (#4285) 2022-11-28 07:39:38 -08:00
test_operator_overloading.py chore: update to black 23 (#4482) 2023-02-01 14:23:37 -05:00
test_pickling.cpp Test pickling a simple callable (does not work). (#3906) 2022-05-02 12:39:36 -07:00
test_pickling.py Test pickling a simple callable (does not work). (#3906) 2022-05-02 12:39:36 -07:00
test_pytypes.cpp Fix detail::obj_class_name() to work correctly for meta classes. (#4436) 2023-01-02 03:46:17 -08:00
test_pytypes.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_return_value_policy_override.cpp [smart_holder] Auto select return value policy for clif_automatic (#4381) 2022-12-05 14:32:54 -08:00
test_return_value_policy_override.py ruff auto-fixes (to be reviewed) 2023-02-22 12:46:12 -08:00
test_sequences_and_iterators.cpp fix: Revert pfect args make iterator (#4234) 2022-10-21 18:04:01 -04:00
test_sequences_and_iterators.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_smart_ptr.cpp Merge branch 'master' into sh_merge_master 2022-08-07 15:43:25 -07:00
test_smart_ptr.py Merge branch 'master' into sh_merge_master_after_clang-format_etc 2022-02-14 14:36:08 -08:00
test_stl_binders.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_stl_binders.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
test_stl.cpp Merge branch 'master' into sh_merge_master 2022-08-07 15:43:25 -07:00
test_stl.py Merge branch 'master' into sh_merge_master 2023-02-22 12:32:31 -08:00
test_tagbased_polymorphic.cpp Open pybind11 namespace with consistent visility. (#4098) 2022-08-01 11:31:31 -07:00
test_tagbased_polymorphic.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_thread.cpp Fully-automatic clang-format with include reordering (#3713) 2022-02-10 12:17:07 -08:00
test_thread.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_type_caster_odr_guard_1.cpp Add pytest.skip() for CUDACC 2022-10-09 21:58:27 -07:00
test_type_caster_odr_guard_1.py Add pytest.skip() for CUDACC 2022-10-09 21:58:27 -07:00
test_type_caster_odr_guard_2.cpp [smart_holder] type_caster ODR guard (#4022) 2022-07-21 06:38:21 -07:00
test_type_caster_odr_guard_2.py [smart_holder] type_caster ODR guard (#4022) 2022-07-21 06:38:21 -07:00
test_union.cpp Fix assertion failure for unions (#1685) (#1709) 2019-06-11 23:28:58 +02:00
test_union.py Python 2 removal part 1: tests (C++ code is intentionally ~untouched) (#3688) 2022-02-10 18:28:08 -08:00
test_virtual_functions.cpp Merge branch 'master' into sh_merge_master 2022-12-08 23:19:31 -08:00
test_virtual_functions.py chore: move to Ruff and add rules (#4483) 2023-02-22 06:18:55 -08:00
valgrind-numpy-scipy.supp docs: fix various typos (#3075) 2021-07-04 19:58:35 -04:00
valgrind-python.supp chore: get PyPy 3.7 wheels using NumPy 1.20 (#2837) 2021-01-31 17:29:09 -05:00