On Tue, May 18, 2010 at 11:43:30AM +0100, Daniel P. Berrange wrote: > On Tue, May 18, 2010 at 12:32:13PM +0200, Jim Meyering wrote: > > I've just fixed code in a test that ignored virInitialize failure. > > Looking at all uses, I saw one other: in python/libvirt-override.c, > > where the initialization function ignores virInitialize failure: > > > > void > > #ifndef __CYGWIN__ > > initlibvirtmod > > #else > > initcygvirtmod > > #endif > > (void) > > { > > static int initialized = 0; > > > > if (initialized != 0) > > return; > > > > virInitialize(); > > > > /* initialize the python extension module */ > > Py_InitModule((char *) > > #ifndef __CYGWIN__ > > "libvirtmod" > > #else > > "cygvirtmod" > > #endif > > , libvirtMethods); > > > > initialized = 1; > > } > > > > Unfortunately, this function is public, so we can't change its signature. > > More specifically, the signature is defined by Python's loadable > module interface so we're not at liberty to redeclare that. > > > Any suggestions? > > abort() 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 Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list