Skip to content
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

Add a new return value policy _clif_automatic #4343

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

wangxf123456
Copy link
Contributor

Description

This new policy is for making PyCLIF generate pybind11 bindings code.

PyCLIF automatically chooses lifetime management of return values based on the properties of them: https://github.com/google/clif/tree/main/clif/python#pointers-references-and-object-ownership. We would like make the lifetime management of the generated pybind11 code consistent with legacy PyCLIF.

However, this is hard for nested types. For example, for pair<int, const T*> return values, to be consistent with legacy PyCLIF, we would like to apply return_value_policy::copy to int, and return_value_policy::reference to const T*. This is hard to achieve from top down. With the new return value policy, we can implement this from bottom up.

@rwgk rwgk marked this pull request as ready for review November 18, 2022 16:54
@rwgk rwgk merged commit 6d3a0fc into pybind:smart_holder Nov 18, 2022
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Nov 18, 2022
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label Nov 18, 2022
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Jun 11, 2024
rwgk pushed a commit that referenced this pull request Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants