search for: memoryview

Displaying 20 results from an estimated 22 matches for "memoryview".

2019 Nov 23
3
[PATCH nbdkit] python: Pass memoryview to pwrite()
Passing a memoryview we avoid unneeded copy of the original buffer. On the python side memoryview object can be used for slicing, writing to file, or sending to socket. This may break plugins assuming that the they get a bytearray, but good python code should not care about the type of the buffer, only about the behav...
2019 Oct 04
2
samba-tool user syncpasswords crashes with python3
...> 'virtualClearTextUTF8'] > > Fri Oct 4 12:29:52 2019: pid[985]: Call > > Popen[/usr/local/bin/syncpw.py] for > > CN=gorkon_klingons,OU=Users,OU=klingons,OU=Organizations,DC=xxxx,DC > > =xxx > > ERROR(<class 'TypeError'>): uncaught exception - memoryview: a > > bytes- > > like object is required, not 'str' > > File "/usr/local/samba/lib/python3.6/site- > > packages/samba/netcmd/__init__.py", line 186, in _run > > return self.run(*args, **kwargs) > > File "/usr/local/samba/lib/pyt...
2018 Dec 07
2
[PATCH] v2v: -o rhv-upload: Fix emulated zero
Replace python 2 only "buffer" with "memoryview". Falling back to emulated zero would fail with: NameError: name 'buffer' is not defined I did not test the changed code but it was not tested before so it is unlikely to be worse. Detected by pylint. --- v2v/rhv-upload-plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 delet...
2019 Oct 07
1
samba-tool user syncpasswords crashes with python3
...hrieb Rowland penny via samba: > On 04/10/2019 15:28, Heinz H?lzl via samba wrote: > > the script works... > > The script may work when you run it manually, but the error samba- > tool > throws is this: > > ERROR(<class 'TypeError'>): uncaught exception - memoryview: a > bytes-like object is required, not 'str' > > If you examine the error, samba-tool runs your script with this: > > File > "/usr/local/samba/lib/python3.6/site-packages/samba/netcmd/user.py", > line 2001, in run_sync_command > reply = bytes(...
2019 Nov 25
3
[PATCH nbdkit 0/2] python: Implement pread passing buffer for v2 API.
As suggested by Nir, here: https://www.redhat.com/archives/libguestfs/2019-November/thread.html#00220
2019 Oct 04
2
samba-tool user syncpasswords crashes with python3
...'sAMAccountName', 'userAccountControl', 'virtualClearTextUTF8'] Fri Oct 4 12:29:52 2019: pid[985]: Call Popen[/usr/local/bin/syncpw.py] for CN=gorkon_klingons,OU=Users,OU=klingons,OU=Organizations,DC=xxxx,DC=xxx ERROR(<class 'TypeError'>): uncaught exception - memoryview: a bytes- like object is required, not 'str' File "/usr/local/samba/lib/python3.6/site- packages/samba/netcmd/__init__.py", line 186, in _run return self.run(*args, **kwargs) File "/usr/local/samba/lib/python3.6/site- packages/samba/netcmd/user.py", line 2368, in...
2019 Nov 23
1
[PATCH] python: Support buffer protocol for pread() result
pread() can return now any object supporting the buffer protocol[1] such as bytearray, bytes, or memoryview. [1] https://docs.python.org/3/c-api/buffer.html --- When the new python tests will be in master we can add some automated tests. For now I tested this manually using the example plugin as is and with these changes:  def pread(h, count, offset):      global disk     return bytes(disk[offset:of...
2018 Dec 07
0
Re: [PATCH] v2v: -o rhv-upload: Fix emulated zero
On Fri, Dec 07, 2018 at 07:55:28PM +0200, Nir Soffer wrote: > Replace python 2 only "buffer" with "memoryview". > > Falling back to emulated zero would fail with: > > NameError: name 'buffer' is not defined > > I did not test the changed code but it was not tested before so it is > unlikely to be worse. > > Detected by pylint. Thanks - I pushed both. I wond...
2018 Dec 07
1
Re: [PATCH] v2v: -o rhv-upload: Fix emulated zero
On Fri, Dec 7, 2018 at 8:50 PM Richard W.M. Jones <rjones@redhat.com> wrote: > On Fri, Dec 07, 2018 at 07:55:28PM +0200, Nir Soffer wrote: > > Replace python 2 only "buffer" with "memoryview". > > > > Falling back to emulated zero would fail with: > > > > NameError: name 'buffer' is not defined > > > > I did not test the changed code but it was not tested before so it is > > unlikely to be worse. > > > > Detected by...
2019 Oct 04
0
samba-tool user syncpasswords crashes with python3
...'userAccountControl', > 'virtualClearTextUTF8'] > Fri Oct 4 12:29:52 2019: pid[985]: Call > Popen[/usr/local/bin/syncpw.py] for > CN=gorkon_klingons,OU=Users,OU=klingons,OU=Organizations,DC=xxxx,DC=xxx > ERROR(<class 'TypeError'>): uncaught exception - memoryview: a bytes- > like object is required, not 'str' > File "/usr/local/samba/lib/python3.6/site- > packages/samba/netcmd/__init__.py", line 186, in _run > return self.run(*args, **kwargs) > File "/usr/local/samba/lib/python3.6/site- > packages/samba/ne...
2019 Nov 23
2
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...lient.HTTPSConnection("www.python.org") > > >>> c.request("GET", "/") > > >>> r = c.getresponse() > > >>> r.read()[:10] > > b'<!doctype ' > > > > I think the plugin should support both bytearray, memoryview, or > > bytes. Supporting objects > > implementing the buffer protocol would be best. > > I thought bytearray & bytes were the same thing :-/ > > Would adding this break existing nbdkit Python scripts? Should this > be considered for v2 of the API? Are there perform...
2019 Nov 25
7
[PATCH nbdkit v2 0/7] Implement nbdkit API v2 for Python plugins.
v3 was here: https://www.redhat.com/archives/libguestfs/2019-November/msg00209.html In v4: - Rebase on top of current master. Includes various fixes and updates required because of Nir's patches that went into master. - Fix api_version() -> API_VERSION in patch 2 noted previously on the mailing list. Rich.
2019 Nov 23
0
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...> >>> c = http.client.HTTPSConnection("www.python.org") > >>> c.request("GET", "/") > >>> r = c.getresponse() > >>> r.read()[:10] > b'<!doctype ' > > I think the plugin should support both bytearray, memoryview, or > bytes. Supporting objects > implementing the buffer protocol would be best. I thought bytearray & bytes were the same thing :-/ Would adding this break existing nbdkit Python scripts? Should this be considered for v2 of the API? Are there performance implications / improvements...
2019 Nov 22
3
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...using HTTPConnection return bytes: >>> c = http.client.HTTPSConnection("www.python.org") >>> c.request("GET", "/") >>> r = c.getresponse() >>> r.read()[:10] b'<!doctype ' I think the plugin should support both bytearray, memoryview, or bytes. Supporting objects implementing the buffer protocol would be best. > + > +def pwrite(h, buf, offset, flags): > + expect_fua = cfg.get ('pwrite_expect_fua', False) > + actual_fua = bool (flags & nbdkit.FLAG_FUA) > + assert expect_fua == actual_fua >...
2019 Nov 24
0
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...w.python.org") > > > >>> c.request("GET", "/") > > > >>> r = c.getresponse() > > > >>> r.read()[:10] > > > b'<!doctype ' > > > > > > I think the plugin should support both bytearray, memoryview, or > > > bytes. Supporting objects > > > implementing the buffer protocol would be best. > > > > I thought bytearray & bytes were the same thing :-/ > > > > Would adding this break existing nbdkit Python scripts? Should this > > be considered fo...
2019 Nov 23
8
[PATCH nbdkit v3 0/7] Implement nbdkit API v2 for Python plugins.
v2 was here: https://www.redhat.com/archives/libguestfs/2019-November/msg00163.html I pushed patch 1 (with spelling fix), patch 4 and patch 5 since those were previously ACKed on the list. Differences in v3: - Add error checking to PyModule_AddIntConstant. - Use API_VERSION constant instead of function. - Add max API version supported to --dump-plugin output. - Print API_VERSION selected by
2019 Nov 25
0
[PATCH nbdkit 1/2] python: For v2 API, avoid copy by passing a buffer to pread.
...tion should construct a buffer of length -(at least) C<count> bytes. You should read C<count> bytes from the -disk starting at C<offset>. C<flags> is always 0. - -The returned buffer can be any type compatible with the Python 3 -buffer protocol, such as bytearray, bytes or memoryview -(L<https://docs.python.org/3/c-api/buffer.html>) +The body of your C<pread> function should read exactly C<len(buf)> +bytes of data starting at disk C<offset> and write it into the buffer +C<buf>. C<flags> is always 0. NBD only supports whole reads, so your...
2009 May 10
2
In C, a fast way to slice a vector?
Hello, Suppose in the following code, PROTECT(sr = R_tryEval( .... )) sr is a RAWSXP vector. I wish to return another RAWSXP starting at position 13 onwards (base=0). I could create another RAWSXP of the correct length and then memcpy the required bytes and length to this new one. However is there a more efficient method? Regards Saptarshi Guha
2019 Nov 24
1
Re: [PATCH nbdkit v2 10/10] tests: Test the Python plugin thoroughly.
...> > >>> c.request("GET", "/") > > > > >>> r = c.getresponse() > > > > >>> r.read()[:10] > > > > b'<!doctype ' > > > > > > > > I think the plugin should support both bytearray, memoryview, or > > > > bytes. Supporting objects > > > > implementing the buffer protocol would be best. > > > > > > I thought bytearray & bytes were the same thing :-/ > > > > > > Would adding this break existing nbdkit Python scripts? Should t...
2020 Feb 27
0
ANNOUNCE: nbdkit 1.18 - high performance NBD server
...I which avoids copying the data buffer, improving performance. The original protocol (now retrospectively called version 1) is still supported for backwards compatibility. The version 1 protocol was also enhanced to support the buffer protocol for the pread method, and memoryview for pwrite, improving performance by reducing copies (Nir Soffer). The Python plugin now prints readable stack traces when an exception is thrown (Nir Soffer). New methods implemented in the Python plugin: cache, can_cache, can_zero, can_fast_zero, can_multi_con...