pgi-docgen
pgi-docgen copied to clipboard
Some of Gio.InputStream's read methods use byte type buffers, which is an immutable type
The read_async and read_all_async methods
https://lazka.github.io/pgi-docs/#Gio-2.0/classes/InputStream.html#Gio.InputStream.read_async https://lazka.github.io/pgi-docs/#Gio-2.0/classes/InputStream.html#Gio.InputStream.read_all_async
both take an argument called "buffer" of type bytes. When you click on the hyperlink, you get directed to the documentation on python strings (https://docs.python.org/3/library/stdtypes.html#str), which is not the same type as python bytes. The buffer argument is used by the methods to buffer data, but byte type objects are immutable and therefore should not be written to. I have tried using these methods with byte type buffer, the code runs without warnings, ocassionally works but gives hard-to-detect intermittent errors. I do not know what type one should use here but surely byte must be wrong. Additionally, in the method description, it is not clear what "count" refers to (although one might assume it is the size of the byte object). In the C functions, count appear as arguments to the function, but here they do not.
Yeah, those functions don't work with bindings, the read_bytes_x variants might.
Yes, from my (small) experience those versions work.