Using Py_buffer and PyMemoryView_FromBuffer with different itemsizes
问题 This question is related to a previous question I asked. Namely this one if anyone is interested. Basically, what I want to do is to expose a C array to Python using a Py_buffer wrapped in a memoryview -object. I've gotten it to work using PyBuffer_FillInfo (work = I can manipulate the data in Python and write it to stdout in C), but if I try to roll my own buffer I get a segfault after the C function returns. I need to create my own buffer because PyBuffer_FillInfo assumes that the format is