I'm studying zero-copy message format in python, specifically flatbuffer/capnproto/sbe. The zero-decoding in C++ is implemented in a way that we can init a variable with specific type, then point its pointer to the address in memory where we received the message into. How can I do the same in python?
I can write C/C++/Cython module to implement custom PyObject, but I don't know how it can affect the GC. Do I have to manage the buffer myself, or I can do some kind of linking the Ref counter to auto GC the buffer when the object is GC-ed?