search for: pytuple_getitem

Displaying 9 results from an estimated 9 matches for "pytuple_getitem".

2020 Aug 10
5
[PATCH nbdkit] python: Implement can_extents + extents.
...et, 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); + return -1; + } + py_offset = PyTuple_GetItem (t, 0); + py_length = PyTuple_GetItem (t, 1); + py_type = PyTuple_GetItem (t, 2); + extent_offset = PyLong_AsUnsignedLongLong (py_offset); + extent_length = PyLong_AsUnsignedLongLong (py_length); + extent_type = PyLong_AsUnsignedLong (py_type); + if (check_python_failu...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...t_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); > + return -1; > + } > + py_offset = PyTuple_GetItem (t, 0); > + py_length = PyTuple_GetItem (t, 1); > + py_type = PyTuple_GetItem (t, 2); > + extent_offset = PyLong_AsUnsignedLongLong (py_offset); > + extent_length = PyLong_AsUnsignedLongLong (py_length); > + extent_type = PyLong_AsUnsignedLong (py_type); >...
2020 Aug 10
0
Re: [PATCH nbdkit] python: Implement can_extents + extents.
...t_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); > + return -1; > + } > + py_offset = PyTuple_GetItem (t, 0); > + py_length = PyTuple_GetItem (t, 1); > + py_type = PyTuple_GetItem (t, 2); > + extent_offset = PyLong_AsUnsignedLongLong (py_offset); > + extent_length = PyLong_AsUnsignedLongLong (py_length); > + extent_type = PyLong_AsUnsignedLong (py_type); >...
2018 Apr 11
0
[nbdkit PATCH v2 1/5] python: Let zero's may_trim parameter be optional
...quot;); +#else + pname = PyString_FromString ("getargspec"); +#endif + spec = PyObject_CallMethodObjArgs (inspect, pname, fn, NULL); + Py_DECREF (pname); + Py_DECREF (inspect); + if (!spec) + return -1; + + /* We got the signature; now check for the requested keyword */ + args = PyTuple_GetItem (spec, 0); + if (check_list (args, name)) + r = 1; +#if PY_MAJOR_VERSION >= 3 + else { + args = PyTuple_GetItem (spec, 5); + if (check_list (args, name)) + r = 1; + } +#endif + + Py_DECREF (spec); + return r; +} + /* Convert bytes/str/unicode into a string. Caller must free....
2018 Apr 06
1
[nbdkit PATCH] python: Let zero's may_trim parameter be optional
...name = PyString_FromString ("getargspec"); +#endif + spec = PyObject_CallMethodObjArgs (inspect, pname, fn, NULL); + Py_DECREF (pname); + Py_DECREF (inspect); + if (!spec) + return -1; + + /* Yay, we got the signature; now inspect if it contains keyword 'name' */ + args = PyTuple_GetItem(spec, 0); + if (check_list(args, name)) + r = 1; + else { + /* inspecting kwonly args is only available in python 3 */ + args = PyTuple_GetItem(spec, 5); + if (check_list(args, name)) + r = 1; + } + + Py_DECREF (spec); + return r; +} + /* Convert bytes/str/unicode into a stri...
2020 Sep 01
0
[nbdkit PATCH 1/2] python: Implement .list_exports and friends
...if (!name) { + if (!PyTuple_Check (t) || PyTuple_Size (t) != 2) { + nbdkit_error ("list_exports method did not return an iterable of " + "2-tuples"); + Py_DECREF (iter); + Py_DECREF (r); + return -1; + } + py_name = PyTuple_GetItem (t, 0); + py_desc = PyTuple_GetItem (t, 1); + name = python_to_string (py_name); + desc = python_to_string (py_desc); + if (name == NULL || desc == NULL) { + nbdkit_error ("list_exports method did not return an iterable of " + "string 2...
2020 Sep 01
4
[nbdkit PATCH 0/2] More language bindings for .list_exports
This picks up python and ocaml. Some of our languages are lacking a number of bindings (for example, lua and perl lack .extents, so I didn't have anything to copy from), and I felt less comfortable with golang and rust. But for python and ocaml, I was able to test a working implementation. Eric Blake (2): python: Implement .list_exports and friends ocaml: Implement .list_exports and
2018 Apr 11
10
[nbdkit PATCH v2 0/5] FUA support in Python scripts
First out of our four language bindings to add FUA support (for reference, I added 'zero' support for python, perl, and ruby back in 1.1.13, then Rich had to add it for ocaml in 1.1.20). I tested this heavily under python 2, but for now only compile tested under python 3; I plan to do further testing there and make any tweaks if necessary. I wrote patch 5 early on, but then realized I
2020 Sep 21
18
[nbdkit PATCH v3 00/14] exportname filter
It's been several weeks since I posted v2 (I got distracted by improving libnbd to better test things, which in turn surfaced some major memory leak problems in nbdsh that are now fixed). Many of the patches are minor rebases from v2, with the biggest changes being fallout from: - patch 2: rename nbdkit_add_default_export to nbdkit_use_default_export - overall: this missed 1.22, so update