search for: pymodule_getdict

Displaying 3 results from an estimated 3 matches for "pymodule_getdict".

Did you mean: _pymodule_getdict
2019 Nov 22
1
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
...gt; > pointer callback. But it is that much more glue code to figure out how > > to check for a python global variable, compared to the glue code we > > already have for calling a python function. > > The extra glue code is (without error handling): > > PyObject *d = PyModule_GetDict(PyObject *module); > PyObject *v = PyDict_GetItemString(d, "API_VERSION"); > long api_version = PyLong_AsLong(v); Or simpler (with error handling): PyObject *v = PyObject_GetAttrString(m, "API_VERSION"); if (v == NULL) return 1; long value =...
2019 Nov 22
4
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
On 11/22/19 3:20 PM, Nir Soffer wrote: >>> +# There are several variants of the API. nbdkit will call this >>> +# function first to determine which one you want to use. This is the >>> +# latest version at the time this example was written. >>> +def api_version(): >>> + return 2 >> >> Matches the C counterpart of #define
2019 Nov 22
0
Re: [PATCH nbdkit v2 03/10] python: Implement nbdkit API version 2.
...constant rather than a function > pointer callback. But it is that much more glue code to figure out how > to check for a python global variable, compared to the glue code we > already have for calling a python function. The extra glue code is (without error handling): PyObject *d = PyModule_GetDict(PyObject *module); PyObject *v = PyDict_GetItemString(d, "API_VERSION"); long api_version = PyLong_AsLong(v);