-
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
pybind11 fork: Ensure failed overload with unique_ptr
returns ownership
#8160
Comments
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
1 task
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Feb 23, 2018
EricCousineau-TRI
added a commit
to RobotLocomotion/pybind11
that referenced
this issue
Feb 26, 2018
unique_ptr: Fix ownership issues for failed overloads (RobotLocomotion/drake#8160)
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Mar 22, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Mar 22, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Apr 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
Apr 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
May 23, 2018
EricCousineau-TRI
added a commit
to EricCousineau-TRI/pybind11
that referenced
this issue
May 23, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@apojomovsky ran into a situation where a set of ovlerloads look like something to the effect of:
When Python calls something like:
this will most likely failure with the following error:
This most likely happens since
pybind11::detail::argument_loader
does not have a "transaction" mechanism of sort; the cast ofunique_ptr<A>
succeeds when it tries to match the first overload, but when it is unable to load the second argument, it will just exit out, and not try to reverse the ownership transfer:https://github.com/RobotLocomotion/pybind11/blob/060f8eb/include/pybind11/cast.h#L2138
The solution is to introduce some sort of "transaction" mechanism.
From what it looks like, I detect ownership transfer from the
move_only_holder_caster
; if the caster is destructed without having transferred the object, then it can reverse the ownership transfer (simply callingcast
to release ownership back to Python).The text was updated successfully, but these errors were encountered: