From: Gianni Tedesco Subject: Re: [PATCH 07 of 10] pyxl: Recursively scan type-tree to produce complete binding boilerplate Date: Wed, 12 Jan 2011 13:20:42 +0000 Message-ID: <1294838442.12018.176.camel@qabil.uk.xensource.com> References: <735df86eab9a758431f9.1294761800@localhost6.localdomain6> <19756.44770.460102.929525@mariner.uk.xensource.com> <1294836642.12018.157.camel@qabil.uk.xensource.com> <19757.42374.308850.600640@mariner.uk.xensource.com> <19757.42493.138178.10916@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <19757.42493.138178.10916@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: Ian, Campbell , "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2011-01-12 at 13:00 +0000, Ian Jackson wrote: > I wrote: > > If you need to do something which changes the autogenerated code then > > I'll be wanting a second opinion at least. > > Specifically, I'd like some a discussion of each change to the > autogenerated output, and why it is necessary/justifiable/safe. OK, well the code I resubmitted just then no longer makes that change to auto-generated code. Btw. we are talking about whether that field gets free()'d in the destructor function. The problem is that this field is used once in libxl and it's assigned as "", a static const char *. In the original version of the patch I submitted the change leads to free() being called on that which is erroneous. Changing it to not be const is a problem because callers will need to know to strdup() now but the compiler wont be able to tell them that. So, on the flip-side, my solution (patch v2) has just been to cast this (const char *) to (char *) when we modify it from python bindings. This is mostly fine correct the bindings handle all allocations. The problem is that we just call the destructor function when the object in question's (domain_build_info) goes away. A workaround is to assign None to the field after it has been set to a string but before the variable goes out of scope and gets collected. It's a leak, but it's a small one. It would be a matter of a few more lines of code in gewrap.py to make that go away. Perhaps I should make these changes and re-submit end portion of series? Gianni