From: Gianni Tedesco Subject: Re: [PATCH 1 of 4] Support getting topology info in libxl Date: Thu, 9 Dec 2010 12:09:53 +0000 Message-ID: <1291896594.15778.15.camel@qabil.uk.xensource.com> References: <37fdfe90e0c26bfac22e.1290755424@merano1.osd.mch.fsc.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <37fdfe90e0c26bfac22e.1290755424@merano1.osd.mch.fsc.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Juergen Gross Cc: Ian, Campbell , "xen-devel@lists.xensource.com" , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Fri, 2010-11-26 at 07:10 +0000, Juergen Gross wrote: > diff -r 79b71c77907b -r 37fdfe90e0c2 tools/python/xen/lowlevel/xl/xl.c > --- a/tools/python/xen/lowlevel/xl/xl.c Wed Nov 24 10:20:03 2010 +0000 > +++ b/tools/python/xen/lowlevel/xl/xl.c Thu Nov 25 09:29:43 2010 +0100 > @@ -224,6 +224,11 @@ > return 0; > } > > +int attrib__libxl_cpuarray_set(PyObject *v, libxl_cpuarray *pptr) > +{ > + return -1; > +} > + > int attrib__libxl_domain_build_state_ptr_set(PyObject *v, libxl_domain_build_state **pptr) > { > return -1; > @@ -284,6 +289,25 @@ > } > } > return cpulist; > +} > + > +PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr) > +{ > + PyObject *list = NULL; > + int i; > + > + list = PyList_New(0); > + for (i = 0; i < pptr->entries; i++) { > + if (pptr->array[i] == LIBXL_CPUARRAY_INVENTRY) { > + PyList_Append(list, Py_None); Needs a Py_INCREF(Py_None); - this is a confusing rule about python lists. There are actually a slew of these Py_None refcounting bugs in there that I have a patch for and will send out at some point. Thanks for the patch Gianni