Displaying 4 results from an estimated 4 matches for "py_length".
2020 Aug 10
2
[PATCH nbdkit] python: Allow extents to return any iterable (which includes lists).
...iter = PyObject_GetIter (r);
+ if (iter == NULL) {
+ nbdkit_error ("extents method did not return "
+ "something which is iterable");
Py_DECREF (r);
return -1;
}
- for (i = 0; i < size; ++i) {
- PyObject *t, *py_offset, *py_length, *py_type;
+ size = 0;
+ while ((t = PyIter_Next (iter)) != NULL) {
+ PyObject *py_offset, *py_length, *py_type;
uint64_t extent_offset, extent_length;
uint32_t extent_type;
- t = PyList_GetItem (r, i);
+ size++;
+
if (!PyTuple_Check (t) || PyTuple_Size (...
2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...a
+ * tuple (offset, length, type).
+ */
+ if (!PyList_Check (r)) {
+ nbdkit_error ("extents method did not return a list");
+ Py_DECREF (r);
+ return -1;
+ }
+
+ size = PyList_Size (r);
+ for (i = 0; i < size; ++i) {
+ PyObject *t, *py_offset, *py_length, *py_type;
+ uint64_t extent_offset, extent_length;
+ uint32_t extent_type;
+
+ t = PyList_GetItem (r, i);
+ if (!PyTuple_Check (t) || PyTuple_Size (t) != 3) {
+ nbdkit_error ("extents method did not return a list of 3-tuples");
+ Py_DECREF (r);
+...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...*/
> + if (!PyList_Check (r)) {
> + nbdkit_error ("extents method did not return a list");
> + Py_DECREF (r);
> + return -1;
> + }
> +
> + size = PyList_Size (r);
> + for (i = 0; i < size; ++i) {
> + PyObject *t, *py_offset, *py_length, *py_type;
> + uint64_t extent_offset, extent_length;
> + uint32_t extent_type;
> +
> + t = PyList_GetItem (r, i);
> + if (!PyTuple_Check (t) || PyTuple_Size (t) != 3) {
> + nbdkit_error ("extents method did not return a list of 3-tuples");
>...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...m sure this is
supported by the C API.
> + nbdkit_error ("extents method did not return a list");
> + Py_DECREF (r);
> + return -1;
> + }
> +
> + size = PyList_Size (r);
> + for (i = 0; i < size; ++i) {
> + PyObject *t, *py_offset, *py_length, *py_type;
> + uint64_t extent_offset, extent_length;
> + uint32_t extent_type;
> +
> + t = PyList_GetItem (r, i);
> + if (!PyTuple_Check (t) || PyTuple_Size (t) != 3) {
> + nbdkit_error ("extents method did not return a list of 3-tuples");
>...