On 10/21/14 11:04, Luyao Huang wrote: > When set flags=libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, python will report > a error: > OverflowError: signed integer is greater than maximum > > Because VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 2147483648 (2**31), and it set a > signed int in PyArg_ParseTuple function. > > if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats", > &pyobj_conn, &py_domlist, &stats, &flags)) > > When python >= 2.3, 'I' means unsigned int and 'i' means int,so there should use 'I'. > > From: https://docs.python.org/2/c-api/arg.html > > I also found a lot of function use 'i' for a unsigned int, but i didn't change them. Few too long lines and unclear sentences in the commit message. > > Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx> > --- > libvirt-override.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libvirt-override.c b/libvirt-override.c > index c887b71..6dacdac 100644 > --- a/libvirt-override.c > +++ b/libvirt-override.c > @@ -8126,7 +8126,7 @@ libvirt_virDomainListGetStats(PyObject *self ATTRIBUTE_UNUSED, > unsigned int flags; > unsigned int stats; > > - if (!PyArg_ParseTuple(args, (char *)"OOii:virDomainListGetStats", > + if (!PyArg_ParseTuple(args, (char *)"OOII:virDomainListGetStats", > &pyobj_conn, &py_domlist, &stats, &flags)) > return NULL; > > ACK, I'll clean up the commit message before pushing. Peter
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list