Make reference(_internal) the default return value policy for properties #473
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See #436 for related discussion.
The tests should cover all possible combinations of
def_propery*
andreturn_value_policy
and make sure the correct overload is chosen:cppfunction
To make the new default
reference(_internal)
policy work correctly for rvalues,type_caster_base
needed to be tweaked as well. The discussed always-move policy turned into 'almost always'.copy
will still be honored if it's selected explicitly. I'm not sure that anyone would actually want to do this (move
already has a fallback for copy-only classes), but I guess it's best not to forbid a valid option. However, all other policies are outright errors for rvalues (pointer to temporary) and therefore cannot be selected.