Re: [xml] I'm lost in generator.py...
- From: Daniel Veillard <veillard redhat com>
- To: Stéphane Bidoul <stephane bidoul softwareag com>
- Cc: xml gnome org
- Subject: Re: [xml] I'm lost in generator.py...
- Date: Sat, 26 Apr 2003 07:15:28 -0400
On Sat, Apr 26, 2003 at 12:44:20PM +0200, Stéphane Bidoul wrote:
Hi,
Hi,
I'm trying to build the python bindings from CVS on windows.
Everything looks fine with python 2.2, but with python 2.1 the
reader6.py test fails complaining that RelaxNGSetSchema
is missing.
Actually, it's generated but on the relaxNgSchema class instead
of xmlTextReader...
okay,
I interpret the problem as follow: the loop at line 843 in generator.py
(for type in ctypes: ...) emits a method for the class when the C type
is either the *first or second* argument of the C function. And there lies
the problem: some methods have C types that map to python classes
both as first and second argument, and thus the class where the method
is emitted bacically depends on the order of types in the ctypes list...
and that order depends on some dictionary hashing
[ouf... 'hope it's more or less clear].
Right, I understand now ... that's a design problem in the generator,
I agree.
I naively tried the attached patch to give priority to functions where the C
type
corresponding to the python class comes first, but that breaks tests
on relaxNGValidateDoc, reconciliateNs, getBase that all have python
mapped types has first and second argument.
So, did I miss something entirely? is there an easy fix?
I wonder if the correct handling for this is not to simply populate
all the related classes with the associated methods, 1/ that sounds
more othogonal dropping an arbitrary selection when both class could
perfectly claim the method as useful 2/ it sounds like the implementation
would be trivial, simply by removing "if found == 1: break" from the
loop forcing to go over all entries.
I tried it here, libxml2.py grew from 213077 bytes to 238581 bytes
indicating that some functions were now dispatched to more classes
and the regression tests were still okay. Can you try this, I'm sure
it's the best way to proceed,
thanks,
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]