Ralf W. Grosse-Kunstleve
cce23af383
Fixes based on newly added pre-submit checks.
2021-10-11 13:22:39 -07:00
Ralf W. Grosse-Kunstleve
191769c29b
Automatic isort fixes.
2021-08-14 08:34:52 -07:00
Ralf W. Grosse-Kunstleve
14fc79f18e
WIP: restoring valgrind CI on smart_holder branch ( #3090 )
...
* * Rollback of PR #3068 .
* Using latest pytest main branch for 3.9 and 3.10.
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 in test_class_sh_trampoline_shared_from_this.py
First experiment combining two potential fixes: latest pytest, workaround.
If this succeeds the next step will be to try only latest pytest without the workaround.
Note: the workaround is known to resolve the MSAN error reported under
https://github.com/pybind/pybind11/pull/3068#issuecomment-877658470
* WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 = False
* Narrowing down WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 to Python 3.9
2021-07-10 17:54:23 -07:00
Ralf W. Grosse-Kunstleve
00b0365ca3
codespell fixes and adding .codespell-ignorelines
2021-07-06 14:31:18 -07:00
Ralf W. Grosse-Kunstleve
5af253d66c
Adding test_multiple_registered_instances_for_same_pointee_recursive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a021e045a9
Adding test_multiple_registered_instances_for_same_pointee_leak. Subtle changes in smart_holder_type_caster_load, trying to work on weak_ptr for shared_ptr_trampoline_self_life_support, but that didn't work out. Manually fully leak-checked again.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e2108546e1
Adding unit tests: 2 x test_std_make_shared_factory
...
Completes unit test coverage for the changed code in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
1b752f56c1
Adding unit test: test_multiple_registered_instances_for_same_pointee
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
64716cc14c
Adding a few comments after review by @laramiel.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
146a925e4e
Resolving TODOs for from_unique_ptr
void_cast_raw_ptr
. Adding test to exercise the path through cast
. The path through init.h is missing a test that would fail if the flag is incorrect. The plan is to systematically cover all situations (there are many that are not exercised for shared_from_this).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
a0e19bdc46
Use casting to void *
to evade to shared_from_this mechanism only if pointee_depends_on_holder_owner
, but currently only for from_raw_ptr_take_ownership
.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
ccd16a1a14
Adding test_pure_cpp_sft_raw_ptr (with 3 TODO: Fix), test_pure_cpp_sft_shd_ptr (works as desired).
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
48eb78ae77
Simpler and safe implementation based on new requirement: C++ (outside of the Python object) needs to hold a shared_ptr before shared_from_this is called. This is more similar to the existing implementation on current smart_holder HEAD, but still uses a weak_ptr to always return the same shared_ptr as long as C++ does not let it expire.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
3dd89f14df
smart_holder_poc.h: type-erase raw_ptr before passing to shared_ptr::reset, to not trigger populating the shared_from_this weak_ptr. This way the only way the weak_ptr is populated is through loaded_as_shared_ptr. Breaks all but one test in test_class_sh_trampoline_shared_from_this.py, now marked skip WIP to test everything else with the GitHub CI.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
adfd3e1700
Partial cleanup of tests. WIP. The cleanup uncovered a major problem.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bfd4c4893e
Leveraging new noop_deleter_acting_as_weak_ptr_owner
to retrieve released vptr
.
...
The placeholder `vptr` is never exposed anymore, therefore the externally visible `use_count`s are more intuitive.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
4b872febcc
Adding test_pass_released_shared_ptr_as_unique_ptr
, exercising new guard in smart_holder_type_casters.h.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
e04196e82b
Attempts to side-step various platform-specific issues.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
553054b26b
Adding tests involving stashing shared_ptr
s. WIP.
2021-06-30 07:04:31 -07:00
Ralf W. Grosse-Kunstleve
bf8d6a2900
First fully successful attempt to make shared_from_this
and trampolines play nicely.
...
Now also passes the open_spiel iterated_prisoners_dilemma_test ASAN clean, in addition to all pybind11 and PyCLIF unit tests.
The problem was that calling `std::shared_ptr<void>::reset()` with a `void` pointer cannot possibly update the `shared_from_this` `weak_ptr`.
The solution is to store a `shd_ptr_reset` function pointer in `guarded_deleter` (similar in idea to the stored function pointer for calling `delete`).
This commit still includes all debugging code, i.e. is "dirty". The code will be cleaned up after the GitHub CI is fully successful.
2021-06-30 07:04:31 -07:00