From: Luyao Huang <lhu...@redhat.com>

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 <lhu...@redhat.com>
Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 libvirt-override.c | 4 ++--
 1 file 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;

-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to