On Fri, Mar 23, 2007 at 01:02:37PM +0000, Richard W.M. Jones wrote:
Daniel P. Berrange wrote:
>On Fri, Mar 23, 2007 at 12:12:56PM +0000, Richard W.M. Jones wrote:
[...]
>> class virConnect: # libvirtclass.py
>> # ...
>> def listNetworks(self):
[...]
>>
>> static PyObject * // libvir.c
>> libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
>> PyObject *args) {
[...]
>Yes, returning None here is totally bogus - it should be raising a
>libvirtError object.
Which code is wrong here? From looking at this it was my impression
that listNetworks is autogenerated by generator.py, and all the code in
libvir.c is hand-written, but you say:
>Indeed they should - all the generated C code bindings do - its just a few
>of these hand written bindings that are wrong.
Actually looks like it is the generated code actually. The generator.py
appears to only add in the 'raise libvirtError' stuff if the return value
is a virConnectPtr/virDomainPtr/virNeworkPtr object - any other function
with a non-object return value gives back None upon error.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|