Re: [PATCH python 04/14] sanitytest: Fix libvirtError class handling for Python 2.4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 9, 2013 at 9:15 AM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
>
> The Exception class hiearchy in Python 2.4 reports different
> data types than in later Python versions. As a result the
> type(libvirt.libvirtError) does not return 'type'. We just
> special case handling of this class.
>
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  sanitytest.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sanitytest.py b/sanitytest.py
> index bd93fe6..eb4caee 100644
> --- a/sanitytest.py
> +++ b/sanitytest.py
> @@ -39,9 +39,11 @@ for name in dir(libvirt):
>      if name[0] == '_':
>          continue
>      thing = getattr(libvirt, name)
> +    # Special-case libvirtError to deal with python 2.4 difference
> +    # in Exception class type reporting.
>      if type(thing) == int:
>          gotenums.append(name)
> -    elif type(thing) == type:
> +    elif type(thing) == type or name == "libvirtError":
>          gottypes.append(name)
>          gotfunctions[name] = []
>      elif callable(thing):
> --
> 1.8.3.1
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Don't have a setup to test, but in principle the code makes sense.

-- 
Doug Goldstein

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]