search for: nbdkitmethods

Displaying 5 results from an estimated 5 matches for "nbdkitmethods".

2017 Jan 26
0
[nbdkit PATCH v2 5/6] python: Expose nbdkit_set_error to python script
...@@ -54,6 +54,23 @@ static const char *script; static PyObject *module; +static PyObject * +set_error (PyObject *self, PyObject *args) +{ + int err; + + if (!PyArg_ParseTuple(args, "i", &err)) + return NULL; + nbdkit_set_error (err); + Py_RETURN_NONE; +} + +static PyMethodDef NbdkitMethods[] = { + { "set_error", set_error, METH_VARARGS, + "Store an errno value prior to throwing an exception" }, + { NULL } +}; + /* Is a callback defined? */ static int callback_defined (const char *name, PyObject **obj_rtn) @@ -91,6 +108,7 @@ static void py_load (void) {...
2017 Jan 26
10
[nbdkit PATCH v2 0/6] bind .zero to Python
Fix some things I noticed while reviewing v1, and follow Rich's idea to add a new nbdkit_set_error() utility function with a binding for Python users to request a particular error (rather than being forced to live with whatever stale value is in errno after all the intermediate binding glue code). I could not easily find out how to register a C function callable from perl bindings, and have
2019 Sep 11
0
[PATCH nbdkit] python: Drop support for Python 2.
...nbdkit", @@ -234,25 +221,18 @@ static struct PyModuleDef moduledef = { NULL, NULL }; -#endif static PyMODINIT_FUNC create_nbdkit_module (void) { PyObject *m; -#if PY_MAJOR_VERSION >= 3 m = PyModule_Create (&moduledef); -#else - m = Py_InitModule ("nbdkit", NbdkitMethods); -#endif if (m == NULL) { nbdkit_error ("could not create the nbdkit API module"); exit (EXIT_FAILURE); } -#if PY_MAJOR_VERSION >= 3 return m; -#endif } static void @@ -276,13 +256,8 @@ py_dump_plugin (void) PyObject *fn; PyObject *r; -#ifdef PY_VERSION...
2019 Sep 11
3
[PATCH nbdkit] python: Drop support for Python 2.
This patch proposes to drop support for Python 2 in nbdkit. Rather than abruptly drop it everywhere, my proposal is that we point people to nbdkit 1.14 (the current stable version) if they want to continue with Python 2 plugins, while gently reminding them of the upcoming Python 2.7 end of life announcement. Libnbd never supported Python 2. Libguestfs in theory supports Python 2 but I dropped
2017 Jan 27
6
[nbdkit PATCH v3 0/4] bind .zero to Python
This cleans up the existing code base with regards to implicit use of errno from language bindings, then rebases the previous work in python on top of that. I'm still playing with the perl bindings, but got further after reading 'perldoc perlembed'. Eric Blake (4): plugins: Don't use bogus errno from non-C plugins plugins: Add new nbdkit_set_error() utility function python: