Should investigate usage of py::wraper<>
trampoline shim with GC garbage collection (to prevent inheritance slicing)
#2757
Labels
holders
Issues and PRs regarding holders
Motivation
Towards #1333 (as part of the larger umbrella of #2646), this is meant to be my recording of investigating a
py::wrapper<>
shim trampoline with "resurrection" via the Python garbage collection.Proof of Concept
I have a working proof-of-concept that is used for in a fork of pybind11 - see
RobotLocomotion/pybind11:README_DRAKE.md
.The primary points to see are:
py::wrapper<>
py::class_<> methods
(note: some of this is coupled to other issues mentioned in the fork READMEtest_ownership_transfer.py
,test_ownership_transfer.cpp
Drawbacks
Additional Notes
This may not be the best mechanism to prevent slicing. Willi be listing other mechanisms (i.e. PRs / suggestions from others).
External References
object.__del__
\cc @rhaschke @rwgk @YannickJadoul
The text was updated successfully, but these errors were encountered: