[libvirt] [PATCH] Return right error code for baselineCPU

Don Dugger n0ano at n0ano.com
Mon Nov 25 15:40:41 UTC 2013


On Mon, Nov 25, 2013 at 10:45:38AM +0000, Daniel P. Berrange wrote:
> On Sun, Nov 24, 2013 at 10:46:13AM -0600, Doug Goldstein wrote:
> > On Sat, Nov 23, 2013 at 3:15 PM, Don Dugger <n0ano at n0ano.com> wrote:
> > >
> > > This Python interface code is returning a -1 on errors for the
> > > `baselineCPU' API.  Since this API is supposed to return a pointer
> > > the error return value should really be VIR_PY_NONE.
...
> > >
> > 
> > ACK. This is correct. But it obviously changes our API so I'm not
> > really sure how we should handle this, (e.g. document the API as is as
> > note that its broken or fix it).
> 
> The implicit expectation with python APIs is that they all raise an
> exception if the libvirt call fails. So ACK to this bug fix & we
> should put it in maint branches.

Much as I hate to raise the issue this assumption is true for pointer
APIs but APIs that return an integer don't raise an exception, they
just return -1.  Obviously, changing this behavior would be way too
invasive but documenting this behavior should be done somewhere.

-- 
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano at n0ano.com
Ph: 303/443-3786




More information about the libvir-list mailing list