pyliblo icon indicating copy to clipboard operation
pyliblo copied to clipboard

Cannot receive blobs from Python 3

Open oslash opened this issue 8 years ago • 0 comments

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.

oslash avatar Aug 18 '17 23:08 oslash