-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[py lcm] Adjust CreateDefaultValue to avoid unique_ptr #22463
[py lcm] Adjust CreateDefaultValue to avoid unique_ptr #22463
Conversation
a0ea1a8
to
bba32b5
Compare
+@SeanCurtis-TRI for feature review please (to help keep you tuned in to the party happening on channel #21968 -- it's rockin!). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR "Avoiding unique_ptr" is not clearly apparent here. It seems that the base class has introduced the python variant which can be overridden in python under the old name. But the old name still exists and still returns a unique pointer. But even as I write that, I'm dissatisfied with that characterization. Could you elaborate?
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: LGTM missing from assignee SeanCurtis-TRI(platform), needs at least two assigned reviewers
The first argument to any Maybe the other thing to know is that the quoted string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be perfectly frank, I still don't understand the mechanism for python overriding. In C++, CreateDefaultValue()
on the trampoline class is marked final. But CreateDefaultValuePython()
isn't virtual. But presumably, neither of that stops a python class from overriding CreateDefaultValues()
. So, I simply have no mental map of the code path when CreateDefaultValue()
gets invoked by a python class with an overridden CreateDefaultValues()
. I presume that no one in python ever does anything with the symbol CreateDefaultValuePython()
. This corner of the code is completely opaque to me.
So, I'm giving you my stamp, but it's value may be iffy.
Reviewable status: needs at least two assigned reviewers
This reduces our reliance RLG/pybind11 custom unique_ptr semantics.
bba32b5
to
6f676d3
Compare
Here's another try. Probably it's better?
Yes. There are no further C++ subclasses of The pybind11 docs here might help https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python but they don't really explain the how. The contract of the macro is that it finds out whether |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: needs at least two assigned reviewers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. The link helped a bit. The role between trampoline and actual class is made more distinct (if not completely clear).
Reviewable status: needs at least two assigned reviewers
Maybe +@rpoyner-tri for platform review? No rush. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),SeanCurtis-TRI(platform)
Towards #21968.
This change is