ffi.buffer - segmentation fault
I am working with the asyncio
Python module. In a co-routine I defined a cdata
buffer to transfer some data.
When the co-routines are completed at the tear-down phase (performed by asyncio) the interpreter crashes with a message like:
Despite I don't know the implementation details causing this issue, I realized that the problem lied on the way I created the buffer:
my_buffer = my_lib.ffi.buffer(my_lib.ffi.new("unsigned char *"), BYTE_SIZE) # causing segmentation fault
my_buffer = my_lib.ffi.buffer(my_lib.ffi.new(f"unsigned char[{BYTE_SIZE}]")) # no issues
Regarding this issue I would suggest to update the documentation to encourage to use the second form rather the first one, which despite valid, might cause some issues with asyncio.