-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[FEAT] docs: keep_alive should have more nuanced explanation for constructors? #2978
Comments
Shown in unittests: pybind11/tests/test_call_policies.cpp Lines 55 to 63 in 5443043
Add'ly substantiated: master...EricCousineau-TRI:issue-2978-wip pybind11/tests/test_keep_alive.py Lines 45 to 71 in a19a217
|
Also, docs 🤦
|
At present, pybind11 docs for keep alive are as follows:
https://pybind11.readthedocs.io/en/stable/advanced/functions.html?highlight=keep_alive#keep-alive
https://github.com/pybind/pybind11/blob/v2.6.2/docs/advanced/functions.rst#keep-alive
However, it doesn't cover cases like constructors, either via vanilla
py::init()
, or factory-style constructors, as indicated here:https://pybind11.readthedocs.io/en/stable/advanced/classes.html#custom-constructors
I think we (Drake devs) operate under the assumption that a constructor functions as a method, and thus
keep_alive<1, 2>()
would be something like "Keep alive: self keeps first arg alive", but I'm not sure upon reinspection.Motivation: RobotLocomotion/drake#14925 (review)
\cc @hongkai-dai
The text was updated successfully, but these errors were encountered: