[libvirt] python module set-up ignores virInitialize failure

Eric Blake eblake at redhat.com
Tue May 18 15:08:25 UTC 2010


On 05/18/2010 05:56 AM, Jim Meyering wrote:
>> Actually I've got another idea. Make the Py_InitModule() call conditional
>> on virInitialize() suceeding. That way if virInitialize() fails, none of
>> the libvirt APIs will get bound to the python layer, preventing their
>> use
> 
> Either works for me:
> 
>>From 7dbf938ab10657a94702cd766afa336fc68d8c80 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering at redhat.com>
> Date: Tue, 18 May 2010 13:46:27 +0200
> Subject: [PATCH] python: don't ignore virInitialize failure in module initialization
> 
> * python/libvirt-override.c (initlibvirtmod): Upon virInitialize
> failure, skip the Py_InitModule call.

I like this second approach better.  ACK.

>  {
>      static int initialized = 0;

While you're touching this file, do you want to remove the extraneous
initialization (we might as well rely on .bss for zero-initialized data).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list