Daniel P. Berrange wrote:
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 functionwith a non-object return value gives back None upon error.
The generator.py code as it stands doesn't deal with the case where a function is prototyped (in C) as returning 'int'.
If I were to modify generator.py so that it adds the check for functions returning int, then it doesn't work because there is not enough information from just the C return type to tell what the Python return type will be.
As an example: save C returns int Python returns int Current bindings fail to check for ret < 0 and raise an exception. listNetworks C returns int Python returns list of networks, or None Current bindings fail to check for ret == None and raise an exception.We could do some run-time type magic in the generated wrapper, although that seems evil.
I think the above are examples of the only two possible cases. Rich. -- Emerging Technologies, Red Hat http://et.redhat.com/~rjones/ 64 Baker Street, London, W1U 7DF Mobile: +44 7866 314 421 "[Negative numbers] darken the very whole doctrines of the equations and make dark of the things which are in their nature excessively obvious and simple" (Francis Maseres FRS, mathematician, 1759)
Description: S/MIME Cryptographic Signature