Re: [Libguestfs] [libnbd PATCH] python: Accept buffers in nbd.Buffer.from_bytearray()

2022-05-26 Thread Eric Blake
On Thu, May 26, 2022 at 09:16:18AM +0100, Richard W.M. Jones wrote: ... > > But Python already has a handy way to convert any object that supports > > the buffer interface into a bytearray. Using it, we can now support > > many more parameters; passing in b"1"*9 now correctly creates a 9-byte > >

Re: [Libguestfs] [libnbd PATCH] python: Accept buffers in nbd.Buffer.from_bytearray()

2022-05-26 Thread Richard W.M. Jones
On Wed, May 25, 2022 at 08:27:15PM -0500, Eric Blake wrote: > Prior to this patch, the following fails, but at least seems to give a > sensible error: > > $ nbdsh -c 'nbd.Buffer.from_bytearray(b"1"*8)' > Traceback (most recent call last): > File "/usr/lib64/python3.10/runpy.py", line 196, in

[Libguestfs] [libnbd PATCH] python: Accept buffers in nbd.Buffer.from_bytearray()

2022-05-25 Thread Eric Blake
Prior to this patch, the following fails, but at least seems to give a sensible error: $ nbdsh -c 'nbd.Buffer.from_bytearray(b"1"*8)' Traceback (most recent call last): File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File