-
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 framework] Setting context values now clones instead of owns #22455
[py framework] Setting context values now clones instead of owns #22455
Conversation
+@sherm1 for feature review, please. |
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 2 of 2 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion, needs at least two assigned reviewers
bindings/pydrake/systems/framework_py_semantics.cc
line 1106 at r1 (raw file):
return std::make_unique<ContinuousState<T>>( state.Clone(), num_q, num_v, num_z); }),
BTW do the BasicVector-matching overloads have unit tests somewhere?
bb2be53
to
90369ef
Compare
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.
+@rpoyner-tri for platform review, please.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform)
bindings/pydrake/systems/framework_py_semantics.cc
line 1106 at r1 (raw file):
Previously, sherm1 (Michael Sherman) wrote…
BTW do the BasicVector-matching overloads have unit tests somewhere?
They both have code coverage (tests do run them -- confirmed by inserting DRAKE_UNREACHABLE).
However, if I remove them leaving only the VectorBase, then all tests still pass. So, I added more tests for the BasicVector subclassing.
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 2 of 2 files at r2, all commit messages.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform)
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 2 of 2 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),sherm1(platform)
For the following classes ...
... when setting a new value from Python (either in the constructor, or with a set function) the value is now copied instead of aliased. Having the context keep mutable aliases to objects that the user provided is not only too dangerous in the first place, but also incompatible with forthcoming upstream
pybind11
semantics.Towards #21968.
This change is