Commit Graph

6 Commits

Author SHA1 Message Date
Ralf W. Grosse-Kunstleve
08339d6331
Adding tests to exercise corner cases involving disowning. (#2912)
* Adding test_class_sh_disowning.

* Fixing minor namespace naming inconsistency between test_class_sh_*.cpp files.

* Replacing py::overload_cast with plain cast for C++11 compatibility.

* Accommodate that the C++ order of evaluation of function arguments is unspecified.
2021-03-22 12:16:29 -07:00
Ralf W. Grosse-Kunstleve
5319ca3817
Using dynamic_cast<AliasType> to determine pointee_depends_on_holder_owner. (#2910)
* Adaption of PyCLIF virtual_py_cpp_mix test.

* Removing ValueError: Ownership of instance with virtual overrides in Python cannot be transferred to C++. TODO: static_assert alias class needs to inherit from virtual_overrider_self_life_support.

* Bringing back ValueError: "... instance cannot safely be transferred to C++.", but based on dynamic_cast<AliasType>.

* Fixing oversight: adding test_class_sh_virtual_py_cpp_mix.cpp to cmake file.

* clang <= 3.6 compatibility.

* Fixing oversight: dynamic_raw_ptr_cast_if_possible needs special handling for To = void. Adding corresponding missing test in test_class_sh_virtual_py_cpp_mix. Moving dynamic_raw_ptr_cast_if_possible to separate header.

* Changing py::detail::virtual_overrider_self_life_support to py::virtual_overrider_self_life_support.
2021-03-19 12:18:39 -07:00
Ralf W. Grosse-Kunstleve
469792032a
Adding virtual_overrider_self_life_support. (#2902)
* Initial version of virtual_overrider_self_life_support (enables safely passing unique_ptr to C++).

* Clang 3.6, 3.7 compatibility.

* Adding missing default constructor.

* Restoring test for exception for the case that virtual_overrider_self_life_support is not used.

* Fixing oversight: Adding missing holder().ensure_was_not_disowned().

* Adding unit tests for new `struct smart_holder` member functions.

* Moving virtual_overrider_self_life_support to separate include file, with iwyu cleanup.
2021-03-16 06:31:24 -07:00
Ralf W. Grosse-Kunstleve
97a7fb722a
Porting/adapting Dustin's PR #2839 to smart_holder branch (#2886)
* WIP: test setup complete, AddInCppUniquePtr failing (reproduces PyCLIF smart_ptrs_test failure).

* Fully tested locally.

* Adding new tests to cmake file.
2021-03-03 17:58:42 -08:00
Ralf W. Grosse-Kunstleve
6285177afe Undoing accidental commit (this was meant to go to a new branch).
Revert "WIP: test setup complete, AddInCppUniquePtr failing (reproduces PyCLIF smart_ptrs_test failure)."

This reverts commit 20107030ab.
2021-02-27 08:59:43 -08:00
Ralf W. Grosse-Kunstleve
20107030ab WIP: test setup complete, AddInCppUniquePtr failing (reproduces PyCLIF smart_ptrs_test failure). 2021-02-27 08:55:04 -08:00