pyliblo
pyliblo copied to clipboard
Cannot receive blobs from Python 3
In liblo.pyx, inside cdef int _callback(..., blobs are handled like so:
elif t == 'b':
if PY_VERSION_HEX >= 0x03000000:
v = bytes(<unsigned char*>lo_blob_dataptr(argv[i]))
This fails with blobs containing 0-valued bytes, causing them to be cut short. I think I was able to fix the problem by replacing that last line with:
size = lo_blob_datasize(argv[i])
v = (<unsigned char*>lo_blob_dataptr(argv[i]))[:size]
Apologies for the quick & dirty report; I currently don't have the time to prepare a proper PR and figured this is better than nothing.