-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix argument passing from trampoline methods #2911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
... which shouldn't copy or move the argument
As expected, the unit test was failing because args were passed |
332f12b
to
5cc4b44
Compare
1638897
to
aefe2c0
Compare
4e0b350
to
00db8eb
Compare
Probably the test is failing, because it passes the arguments by value instead of by reference.
As expected, the unit test was failing because args were passed by-value and not by reference. However, it wasn't possible to just change the policy to reference or reference_internal. reference gave errors, because const unique_ptr& only accepts reference_internal. reference_internal gives an error, because the parent required for keep_alive is null. Hence, I decided to introduce a new policy to explicitly indicate passing from from Python to C++ via an overridden method. That's the cleanest solution to correctly react to the special needs of this use case.
This PR is failing the unit tests, but only with the valgrind config. I have no idea why. The first failing commit is 4b0b8ae. |
Superseeded by #2916. |
This adds some more
smart_holder
tests that mimic some of my (currently failing) application use cases.Particularly, they consider roundtrip situations where an object is passed around as a reference:
The single failing test in
test_unique_ptr_cref_consumer_roundtrip
andtest_unique_ptr_cref_roundtrip
aren't important. I added them just for completeness. However,test_unique_ptr_consumer_roundtrip
is. For this latter test, I didn't look into the reason yet. Will continue tomorrow...