Add the getCapsule() and createFromCapsule() methods to the PyOperation class.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
@stellaraccident I really don't understand what I've done here, but it works... not that that means much when it comes to memory management. Am I doing it correctly or is there something I'm missing about Operation ownership semantics and interactions with PyObjectRef?
Thanks! You may not have known why, but this is the right way to do it. The unit test has a leak test which verifies that everything gets freed. The factory functions you are using maintain 1:1 correspondence between context and operation objects and the backing capi instances. Let me know if you run in to further issues: ownership of operations is complicated and this stuff doesn't have a lot of mileage on it.
Thanks! I think my success is more a testament to the ownership management infra already there. Landing this now.