Displaying 15 results from an estimated 15 matches for "pybool_fromlong".
2018 Apr 06
1
[nbdkit PATCH] python: Let zero's may_trim parameter be optional
...4);
+ args = PyTuple_New (3);
Py_INCREF (obj); /* decremented by Py_DECREF (args) */
PyTuple_SetItem (args, 0, obj);
PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
- PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
- r = PyObject_CallObject (fn, args);
+ if (zero_may_trim)
+ kwargs = Py_BuildValue("{s:i}", "may_trim", may_trim);
+ r = PyObject_Call (fn, args, kwargs);
Py_DECREF (fn);
Py_DECREF (args);
+ Py_XDECREF (kwargs);
if (last_error == EOP...
2019 Nov 22
0
[PATCH nbdkit v2 01/10] python: Use PyObject_CallFunction instead of constructing the tuple.
...0;
- args = PyTuple_New (4);
- Py_INCREF (obj); /* decremented by Py_DECREF (args) */
- PyTuple_SetItem (args, 0, obj);
- PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
- PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
- PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
- r = PyObject_CallObject (fn, args);
+ r = PyObject_CallFunction (fn, "OiLO",
+ obj, count, offset,
+ may_trim ? Py_True : Py_False, NULL);
Py_DECREF (fn);
- Py_DECREF (args);
if (last_error == EO...
2019 Nov 21
0
[PATCH nbdkit 1/8] python: Use PyObject_CallFunction instead of constructing the tuple.
...0;
- args = PyTuple_New (4);
- Py_INCREF (obj); /* decremented by Py_DECREF (args) */
- PyTuple_SetItem (args, 0, obj);
- PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
- PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
- PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
- r = PyObject_CallObject (fn, args);
+ r = PyObject_CallFunction (fn, "OiLO",
+ obj, count, offset,
+ may_trim ? Py_True : Py_False, NULL);
Py_DECREF (fn);
- Py_DECREF (args);
if (last_error == EO...
2010 Aug 19
0
Xend dont start anymore
...or import XendError
File "//usr/lib64/python/xen/xend/XendError.py", line 19, in ?
from xmlrpclib import Fault
File "/usr/lib/python2.4/xmlrpclib.py", line 506, in ?
from xml.parsers import expat
File "/usr/lib/python2.4/xml/parsers/expat.py", line 34
PyBool_FromLong:PyObject*::+1:
^
SyntaxError: invalid syntax
uname -a
Linux debian 2.6.18-xen #3 SMP Mon Oct 22 15:19:52 CEST 2007 x86_64 GNU/Linux
I really dont know what happend here over night.
I really would appreciate some help
best regards
Peter
--
Neu: GMX De-Mail - Einfach wie E-M...
2017 Jan 26
0
[nbdkit PATCH v2 6/6] python: Support zero callback
...0;
+ args = PyTuple_New (4);
+ Py_INCREF (obj); /* decremented by Py_DECREF (args) */
+ PyTuple_SetItem (args, 0, obj);
+ PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
+ PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
+ PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
+ r = PyObject_CallObject (fn, args);
+ Py_DECREF (fn);
+ Py_DECREF (args);
+ if (last_error == EOPNOTSUPP) {
+ /* When user requests this particular error, we want to
+ gracefully fall back, and to accomodate both a normal return
+ and an exception. */...
2017 Jan 27
0
[nbdkit PATCH v3 4/4] python: Support zero callback
...0;
+ args = PyTuple_New (4);
+ Py_INCREF (obj); /* decremented by Py_DECREF (args) */
+ PyTuple_SetItem (args, 0, obj);
+ PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
+ PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
+ PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
+ r = PyObject_CallObject (fn, args);
+ Py_DECREF (fn);
+ Py_DECREF (args);
+ if (last_error == EOPNOTSUPP) {
+ /* When user requests this particular error, we want to
+ gracefully fall back, and to accomodate both a normal return
+ and an exception. */...
2018 Apr 06
0
[nbdkit PATCH 2/2] python: Simplify calling into plugin
...r);
@@ -306,7 +296,6 @@ static void *
py_open (int readonly)
{
PyObject *fn;
- PyObject *args;
PyObject *handle;
if (!callback_defined ("open", &fn)) {
@@ -316,11 +305,9 @@ py_open (int readonly)
PyErr_Clear ();
- args = PyTuple_New (1);
- PyTuple_SetItem (args, 0, PyBool_FromLong (readonly));
- handle = PyObject_CallObject (fn, args);
+ handle = PyObject_CallFunctionObjArgs (fn, readonly ? Py_True : Py_False,
+ NULL);
Py_DECREF (fn);
- Py_DECREF (args);
if (check_python_failure ("open") == -1)
return NULL;
@@...
2018 Apr 11
0
[nbdkit PATCH v2 1/5] python: Let zero's may_trim parameter be optional
...0;
- args = PyTuple_New (4);
- Py_INCREF (obj); /* decremented by Py_DECREF (args) */
- PyTuple_SetItem (args, 0, obj);
- PyTuple_SetItem (args, 1, PyLong_FromUnsignedLongLong (count));
- PyTuple_SetItem (args, 2, PyLong_FromUnsignedLongLong (offset));
- PyTuple_SetItem (args, 3, PyBool_FromLong (may_trim));
- r = PyObject_CallObject (fn, args);
+ args = Py_BuildValue ("OiL", obj, count, offset);
+ if (!args) {
+ check_python_failure ("zero");
+ Py_DECREF (fn);
+ return -1;
+ }
+ kwargs = PyDict_New ();
+ if (!kwargs) {
+ check_pyth...
2018 Apr 06
6
[nbdkit PATCH 0/2] Python cleanups
I noticed these while working on adding fua support into python,
these are independent enough to push now (and I'll have to rebase
my 'optional may_trim' patch on top of this).
Eric Blake (2):
python: Use Py_XDEFREF()
python: Simplify calling into plugin
plugins/python/python.c | 106 ++++++++----------------------------------------
1 file changed, 18 insertions(+), 88
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
2017 Jan 24
4
[nbdkit PATCH 0/2] bind .zero to more languages
Begin the language binding followups to my new .zero callback, since
Rich was indeed correct that we want them.
I'm more familiar with python and perl (at least to the point that
I was able to modify the appropriate example files and prove to
myself that the bindings worked), so I've started with those.
I'm less familiar with ruby and ocaml, so I've left those for
tomorrow (it
2019 Nov 22
18
[PATCH nbdkit v2 00/10] Implement nbdkit API v2 for Python plugins.
v1:
https://www.redhat.com/archives/libguestfs/2019-November/msg00153.html
v2:
- Fix implementation of can_cache.
- Add implementation of can_fua.
- Add a very thorough test suite which tests every command + flag
combination.
2019 Nov 21
10
[PATCH nbdkit 0/8] Implement nbdkit API v2 for Python plugins.
And fill out most of the missing bits of the API.
Rich.
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:
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