Displaying 3 results from an estimated 3 matches for "pybuf_simple".
2019 Nov 25
0
[PATCH nbdkit 1/2] python: For v2 API, avoid copy by passing a buffer to pread.
..., count, PyBUF_WRITE),
+ offset, flags, NULL);
break;
default: abort ();
}
@@ -535,19 +537,25 @@ py_pread (void *handle, void *buf, uint32_t count, uint64_t offset,
if (check_python_failure ("pread") == -1)
return ret;
- if (PyObject_GetBuffer (r, &view, PyBUF_SIMPLE) == -1) {
- nbdkit_error ("%s: value returned from pread does not support the "
- "buffer protocol",
- script);
- goto out;
- }
+ if (py_api_version == 1) {
+ /* In API v1 the Python pread function had to return a buffer
+ * proto...
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 Nov 23
1
[PATCH] python: Support buffer protocol for pread() result
...obj, count, offset, NULL);
Py_DECREF (fn);
if (check_python_failure ("pread") == -1)
- return -1;
+ return ret;
- if (!PyByteArray_Check (r)) {
- nbdkit_error ("%s: value returned from pread method is not a byte array",
+ if (PyObject_GetBuffer (r, &view, PyBUF_SIMPLE) == -1) {
+ nbdkit_error ("%s: value returned from pread does not support the "
+ "buffer protocol",
script);
- Py_DECREF (r);
- return -1;
+ goto out;
}
- if (PyByteArray_Size (r) < count) {
- nbdkit_error ("%s: b...