summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuyao Huang <lhuang@redhat.com>2014-10-21 17:04:41 +0800
committerPeter Krempa <pkrempa@redhat.com>2014-10-22 09:43:47 +0200
commitb3aa7da4bbc5f44f34cde8a9b719c5c2ecbf7f8b (patch)
treef2131a04de5b03a952f84ba435d551d923ce8b6e
parent7bfe4e3cf68f2725c94fbff4e619b1d12af08164 (diff)
downloadlibvirt-python-b3aa7da4bbc5f44f34cde8a9b719c5c2ecbf7f8b.tar.gz
Fix parsing of 'flags' argument for bulk stats functions
When 'flags' is set to 'libvirt.VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS, python will report a error: OverflowError: signed integer is greater than maximum as VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS is defined as 1<<31. This happens as PyArg_ParseTuple's formatting string containing 'i' as a modifier expects a signed integer. With python >= 2.3, 'I' means unsigned int and 'i' means int so we should use 'I' in the formatting string. See: https://docs.python.org/2/c-api/arg.html Signed-off-by: Luyao Huang <lhuang@redhat.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
-rw-r--r--libvirt-override.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libvirt-override.c b/libvirt-override.c
index b4bb571..84f281a 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -8090,7 +8090,7 @@ libvirt_virConnectGetAllDomainStats(PyObject *self ATTRIBUTE_UNUSED,
unsigned int flags;
unsigned int stats;
- if (!PyArg_ParseTuple(args, (char *)"Oii:virConnectGetAllDomainStats",
+ if (!PyArg_ParseTuple(args, (char *)"OII:virConnectGetAllDomainStats",
&pyobj_conn, &stats, &flags))
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
@@ -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;