I am exposing a PyMemoryView in C on a set of data, like so:
PyMemoryView_FromMemory((char *)ibuf->rect, pixels * sizeof(uint), PyBUF_WRITE);
That data is floating-point data, however, so attempting to do this:
mv = get_my_memory_view()
mv[0] = 3.141
yields the following error:
TypeError: memoryview: invalid type for format 'B'
This is, of course, because the memoryview assumes the underlying data to be byte data, not float. How would I ensure that the memoryview returned from my module has a float specifier?