[libvirt] [libvirt-python PATCH] Fix cannot use VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS flags in domainListGetStats

Peter Krempa pkrempa at redhat.com
Tue Oct 21 13:38:06 UTC 2014


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 at redhat.com>
> ---
>  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141021/c53a73e3/attachment-0001.sig>


More information about the libvir-list mailing list