[libvirt] [libvirt-python v3 PATCH] Improve error output when use getTime with a nonzero flags.

Pavel Hrdina phrdina at redhat.com
Mon Oct 20 15:08:45 UTC 2014


On 10/20/2014 03:55 PM, Luyao Huang wrote:
> When give a nonzero flags to getTime, c_retval will get -1 and goto cleanup.

Try to wrap the lines to 76 columns.

> But py_retval still is NULL,so set py_retval =  VIR_PY_NONE.

s/NULL,so/NULL, so/

> This will make the output message more correct.
>
> error will disappear:
> SystemError: error return without exception set
>
> v2:
> https://www.redhat.com/archives/libvir-list/2014-October/msg00497.html

This comments shouldn't be in the commit message but ...

>
> Signed-off-by: Luyao Huang <lhuang at redhat.com>
> ---

... there.

>   libvirt-override.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libvirt-override.c b/libvirt-override.c
> index 9ba87eb..8690f4f 100644
> --- a/libvirt-override.c
> +++ b/libvirt-override.c
> @@ -7757,9 +7757,11 @@ libvirt_virDomainGetTime(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
>       c_retval = virDomainGetTime(domain, &seconds, &nseconds, flags);
>       LIBVIRT_END_ALLOW_THREADS;
>
> -    if (c_retval < 0)
> +    if (c_retval < 0) {
> +	py_retval = VIR_PY_NONE;

Use spaces instead of tabs.

>           goto cleanup;
> -
> +    }
> +
>       if (!(pyobj_seconds = libvirt_longlongWrap(seconds)) ||
>           PyDict_SetItemString(dict, "seconds", pyobj_seconds) < 0)
>           goto cleanup;
>

ACK to the logic, I'll update the patch and push it, thanks for the fix.

Pavel




More information about the libvir-list mailing list